The purpose of this function is to find all .po files in core/sites/default/translations, or to find a .po for a specific language code if a $langcode parameter is passed. However, the latter case currently doesn't work, because the mask being passed to file_scan_directory() ends up with an extra dot. For example, if 'es' is passed, the pattern becomes "!install\.\.es\.po$!"
Added docs while I was at it.
Comment | File | Size | Author |
---|---|---|---|
#19 | installer-file-test-pass_1.patch | 3.73 KB | tstoeckler |
#16 | installer-file-test-pass_1.patch | 3.73 KB | Gábor Hojtsy |
#11 | installer-file-test-pass.patch | 3.68 KB | Gábor Hojtsy |
#10 | installer-file-test-fail.patch | 2.53 KB | Gábor Hojtsy |
#10 | installer-file-test-pass.patch | 3.73 KB | Gábor Hojtsy |
Comments
Comment #1
David_Rothstein CreditAttribution: David_Rothstein commentedYou may need to upload a patch file without the "-D8" suffix in order to get the testbot to test it, but the patch looks good to me.
Minor issues with the PHPDoc, though: The description of $langcode should probably use the "(optional)" phrasing, and there should be a blank line before @return (see http://drupal.org/node/1354).
Comment #2
Garrett Albright CreditAttribution: Garrett Albright commentedOkay. Patch with suggested docs tweaks attached.
Comment #3
David_Rothstein CreditAttribution: David_Rothstein commentedSorry to nitpick, but the second part (after the semicolon) doesn't look quite right to me. It would probably match existing documentation better if it were a completely new sentence, something more like "If omitted, all available translation files will be returned"?
Comment #4
Garrett Albright CreditAttribution: Garrett Albright commentedOkay.
Comment #5
Gábor Hojtsy@Garrett: First of all, nice find. Thanks for the patch! Now my comments. The code looks good, comments have some issues still.
1. "An array of information about found translation files." is not really descriptive. Array of information can really be anything. I'd add "as returned by file_scan_directory() or somesuch". I don't think this comment adds anything useful at the moment.
2. "Ommitted" should be spelled "Omitted" AFAIK.
Comment #6
Gábor HojtsyNew patch as per my suggestions from yesterday.
Comment #7
David_Rothstein CreditAttribution: David_Rothstein commentedComment #8
catchLooks like we could add some dummy files to a test directoy, change locale_translate_file_directory to to point to that, and write a test for this?
Comment #9
Gábor HojtsyMoving to needs work for that.
Comment #10
Gábor HojtsyHere is a comprehensive test that proves it fails without the patch and a compound patch that should pass (they failed and passed proper on my machine). Please review!
Comment #11
Gábor HojtsyRemoved an incorrectly copy-pasted code comment. No other changes, so not uploading the fail version again :)
Comment #12
Gábor HojtsyOk, testbot proof ready. Human reviews welcome :)
Comment #13
Gábor Hojtsy@catch: what do you think of the added tests? Looks good now to go?
Comment #14
tstoecklerLooks good.
Comment #15
David_Rothstein CreditAttribution: David_Rothstein commentedSorry to bump this back for a few small things, but...
Wrong alphabetical order :)
The class needs some PHPDoc above it.
Also, the name of the class ("InstallerLanguageTestCase") is specific to the language tests, but the getInfo() stuff refers to much more general-sounding tests... so let's pick one or the other. I'd probably go with keeping it all language-specific for the time being, since the setUp() method is doing something that is specific to the language tests.
At least needs to be "Checks" rather than "Check"... but I'd probably go with something more like "Tests that the installer can find translation files"?
Comment #16
Gábor HojtsyOk, all concerns fixed. Good now?
Comment #17
Gábor HojtsyAlso elevating this. The bug basically means the installer will never be translated even if you select a language, because then it cannot actually find the translation file in subsequent requests. The patch fixes that.
Comment #18
David_Rothstein CreditAttribution: David_Rothstein commentedLooks good. Technically, "Test installer language detection" should actually be "Tests installer language detection", but I'm not going to prevent it from sitting in the RTBC state for that.
However, if you rerolled with that change, the coding standards people will be happier :)
Comment #19
tstoecklerRerolled for that.
EDIT: No other changes, so leaving at RTBC.
Comment #20
xjmUntagging 'cause it has tests.
Comment #21
catchLooks good with the new tests. Committed/pushed to 8.x.
Comment #22
David_Rothstein CreditAttribution: David_Rothstein commentedIt looks like installer.test wasn't added.
Not sure if we need a new patch for that or not?... (it should be possible to just reapply the patch above and ignore all the parts that are already there, then add the new file and commit).
Comment #23
catchArggh, well spotted!
Committed/pushed that file to 8.x.
Comment #24
xjmThese files are also missing.
Bumping to critical because branch tests are failing atm.
Comment #25
Gábor HojtsyRTBC since we have the files in the patch? Don't know what else can we do here minus core maintainer action to commit them.
Comment #26
xjmcatch fixed it just now. :)
Comment #27
David_Rothstein CreditAttribution: David_Rothstein commentedOops. Apparently I didn't spot it well enough :)
Comment #29
Gábor HojtsyAdding UI language translation tag.