Problem/Motivation
Found in #1533250: Many coding standards clean-ups in locale module:
in LocaleStringTest
// Load all translations. For next queries we'll be loading only translated strings. $only_translated = array('untranslated' => FALSE);
Looks like that statement accidentally got appended to the comment.
Proposed resolution
Move the $only_translated assignment to its own (non commented out) line, below the comment.
Remaining tasks
- (novice) git instructions for creating patch | Contributor task documentation for creating a patch
- See what the testbot says
User interface changes
None.
API changes
No.
Comments
Comment #1
YesCT CreditAttribution: YesCT commentedComment #2
jmmarquez CreditAttribution: jmmarquez commentedI start with this
Comment #3
jmmarquez CreditAttribution: jmmarquez commentedUploading patch.
Comment #4
steinmb CreditAttribution: steinmb commentedThat should do it :) though a little nitpicking. The inline comment goes beyond 80 chars.
WARNING | Line exceeds 80 characters; contains 88 characters
Perhaps it should be wrapped into two lines?
Comment #5
tstoecklerWait, if
$only_translated
is currently not needed, it should just be removed, right?Comment #6
steinmb CreditAttribution: steinmb commentedYour right.
Comment #7
YesCT CreditAttribution: YesCT commentedwe need to look at the test and think.
if it is not used, maybe it should be used! and the test is not really testing what we are expecting it to.
Comment #8
amitgoyal CreditAttribution: amitgoyal commented@YesCT - Please review attached patch which fixes #4 and #5.
From the code it seems that we don't really need "$only_translated = array('untranslated' => FALSE)".
Comment #9
eugenesia CreditAttribution: eugenesia commentedI started looking at this issue at the LONDON_2014_JUNE Code Sprint, but could only complete it today.
After much study, I think the commented-out statement
$only_translated = array('untranslated' => FALSE)
is indeed extraneous and can be removed, as mentioned in #8 by @amitgoyal.The commented-out statement sits in the function
testStringSearchAPI()
. I've looked at this function and referred to\Drupal\locale\StringStorageInterface
, and I think this function adequately tests all locale string search functions of an object implementingStringStorageInterface
.I tried to find out why this extraneous statement might have been introduced, and can only conclude it was due to unfamiliarity with the locale string search API.
To get only translated strings from
StringStorageInterface->getTranslations()
, you need to pass in a condition ofarray('translated' => TRUE)
, and notarray('untranslated' => FALSE)
.The extraneous statement was introduced in the commit below. This commit created a new file
LocaleStringTest.php
which included the extraneous statement.The relevant issue for the above commit is https://www.drupal.org/node/1785086#comment-6573684 .
So I'm setting this issue's status to RTBC.
Comment #10
eugenesia CreditAttribution: eugenesia commented8: drupal-move_localeStringTest_instruction_out_of_accidental_comment-2271485-8.patch queued for re-testing.
Comment #11
alexpottCommitted 00afbcc and pushed to 8.x. Thanks!