After enabling the content translation module, if you go to (/admin/config/regional/content-language), this text is displayed:

"Before you can translate content, there must be at least two languages added on the languages administration page.Change language settings for content types, taxonomy vocabularies, user profiles, or any other supported element on your site."

Notice that there is no space between the two sentences.

CommentFileSizeAuthor
#7 after-patch-7-space-only.png9.03 KBAnonymous (not verified)
#7 after-patch-7.png9.29 KBAnonymous (not verified)
#7 after-patch-2.png9.36 KBAnonymous (not verified)
#7 before.png9.03 KBAnonymous (not verified)
#7 2845644-7-space-only.patch1.02 KBAnonymous (not verified)
#7 interdiff-2-7.txt1.03 KBAnonymous (not verified)
#7 2845644-7.patch1.95 KBAnonymous (not verified)
#3 drupal-missing-space-between-sentences-2845644-3.patch947 bytesgaurav.kapoor
#2 2845644-2.patch947 bytesAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pgacv2 created an issue. See original summary.

Anonymous’s picture

Status: Active » Needs review
FileSize
947 bytes

"Change language settings..." appeared here, and we have not reason use it without <p> wrapper. Also this patch solves Drupal Coding Standard
Avoid backslash escaping in translatable strings when possible, use "" quotes instead

gaurav.kapoor’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
947 bytes

Patch with correct format uploaded , working and tested.

gaurav.kapoor’s picture

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

cilefen’s picture

Version: 8.3.x-dev » 8.4.x-dev
Issue summary: View changes
Status: Reviewed & tested by the community » Needs work

For me, with the patch, there are two spaces between the paragraphs.

Anonymous’s picture

Original:
before

After patch 2:
before

After patch 7:
before

After patch 7-space-only:
before

gaurav.kapoor’s picture

Status: Needs review » Reviewed & tested by the community

#7 looks good.

xjm’s picture

Issue tags: +DrupalCampNJ2017
alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Which patch is rbtc? I think the patch called 2845644-7.patch is more correct. Adding a space at the end of the sentence just hanging there is really odd. It also means that there is no translatable string change and the issues around RTL languages are better.

Can someone please clarify and think about what's best here.

xmacinfo’s picture

It looks like we are aiming for 2845644-7.patch :-)

@vaplas: can you confirm that you rolled 2845644-7.patch against Drupal 8.4.x-dev?

gaurav.kapoor’s picture

Status: Needs work » Reviewed & tested by the community

Sorry for the confusion in #7 , "2845644-7.patch" : tested this patch , works fine in both 8.3.x and 8.4.x . So marking it back as RTBC. It changes the way the info is displayed to very clean way.

gaurav.kapoor’s picture

Anonymous’s picture

absolutely +1 to 2845644-7.patch. Sorry for the noise with 2845644-7-space-only.patch

xjm’s picture

Issue tags: -Grammar

So I reviewed #7 (the first one) with git diff --color-words and confirmed that it properly wraps paragraphs in <p> tags, rather than using the <br /> which is nonstandard. That also means it does not change any translatable strings by fixing the markup, which is good.

However, it is also changing the quoting on the second string from single to double quotes. This avoids having to escape the apostrophe, but is slightly out of scope. I can't remember whether the translatable strings are parsed by PHP or not right now (i.e., will changing the \' to ' be picked up as a string change that translators need to retranslate). Checking on that now.

The patch does not affect grammar, only whitespace.

xjm’s picture

Okay, I actually dug into potx to answer this question:
http://cgit.drupalcode.org/potx/tree/potx.inc#n709

Strings with no placeholders are identified by looking for T_CONSTANT_ENCAPSED_STRING. Then:

/**
 * Escape quotes in a strings depending on the surrounding
 * quote type used.
 *
 * @param $str
 *   The strings to escape
 */
function _potx_format_quoted_string($str) {
  $quo = substr($str, 0, 1);
  $str = substr($str, 1, -1);
  if ($quo == '"') {
    $str = stripcslashes($str);
  }
  else {
    $str = strtr($str, array("\\'" => "'", "\\\\" => "\\"));
  }
  return addcslashes($str, "\0..\37\\\"");
}

So, they should end up as the same thing, but that wasn't a sure thing.

In the future though, probably best to avoid changing the string's quotation method in another fix, to avoid out of scope changes. See https://www.drupal.org/core/scope for lots of background information on why scope is important, even for small things.

  • xjm committed e94f731 on 8.4.x
    Issue #2845644 by vaplas, gaurav.kapoor: Missing a space between two...
xjm’s picture

Version: 8.4.x-dev » 8.3.x-dev
Status: Reviewed & tested by the community » Fixed

Wrapping any paragraph in paragraph tags ensures that HTML handles the whitespace, and is our standard, so agreed that it is the best fix. In the future let's be sure to upload the intended fix as the last attachment to the issue and avoid even small changes to code that is not part of the fix.

Since this ended up just being a small markup bugfix, without a translatable string change, and since we are still in alpha, I backported it to 8.3.x also to avoid unnecessary divergence.

Thanks everyone! Committed to 8.4.x and 8.3.x.

  • xjm committed b11516b on 8.3.x
    Issue #2845644 by vaplas, gaurav.kapoor: Missing a space between two...
xjm’s picture

Sorry, d.o ate the credit I had saved for this issue, so reverting and recommitting.

  • xjm committed 8f311af on 8.4.x
    Revert "Issue #2845644 by vaplas, gaurav.kapoor: Missing a space between...
  • xjm committed c87ebca on 8.4.x
    Issue #2845644 by vaplas, gaurav.kapoor, xjm, pgacv2, cilefen, alexpott...
xjm’s picture

  • xjm committed 3f442e7 on 8.3.x
    Revert "Issue #2845644 by vaplas, gaurav.kapoor: Missing a space between...
  • xjm committed b56240a on 8.3.x
    Issue #2845644 by vaplas, gaurav.kapoor, xjm, pgacv2, cilefen, alexpott...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

gaurav.kapoor’s picture

I don't understand why there is inconsistency in using single and double quotes in help text for content translation and language module. Shouldn't this also be standardised ?