Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
language system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
18 Aug 2014 at 11:45 UTC
Updated:
11 Sep 2014 at 13:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
gábor hojtsyComment #3
gábor hojtsySo we do have tests for this :)
Comment #5
gábor hojtsyFixing the translation based tests, so they have a local file. Now that the new pattern does not match remote downloads. Fix still needed to cover more possible version formats instead of just this rigid number format. Next up. But this one passes locally.
Comment #6
gábor hojtsyThis now supports files that have suffixes and updates the test to support them.
Comment #9
gábor hojtsyIf Drupal would know its version number this would be critical because in fact translation downloads don't work anymore without this patch. This is the pre-patch regex:
'!drupal-\d+\.[^\.]+\.' . (!empty($langcode) ? preg_quote($langcode, '!') : '[^\.]+') . '\.po$!'This 'accidentally' worked for versions like
drupal-8.0-alpha13because '0-alpha13' matched the sequence of non-dots at the end of version number. However, once the version number isdrupal-8.0.0-alpha14as is now, this will not match. The result being the translations ARE downloaded, but then they are not loaded back from locally because they are not recognized as valid translation files. So you get the translation screen again.This is why in #3 this was failing on two installer tests. In #5 I fixed this by providing local files (that matched the rigid number scheme at the time). In #6 I fixed the regex so it matches extra version elements like alpha/beta and expanded tests.
So practically the only reason this is not critical is because Drupal cannot identify its version number at this time properly and falls back on alpha12 (lack of git deploy and lack of concrete version number in DRUPAL_VERSION). Not something we can fix, so we need to cope with that.
Comment #10
vijaycs85Over all, looks good. just one comment is that covering the version number with various correct/incorrect values.
Would be great to get this unit test covered with various values by @dataProvider method.
Nice improvement by providing our own translation instead of 'notEqual' check.
Nice to see this todo removed :)
Comment #11
gábor hojtsyYeah the InstallerLanguageTest could probably be redone as a unit test but I only wanted to fix the bugs instead of trying to refactor it. It is true that we could include some .po files with wrong names and prove they are not found. That's a good one. If you can help refactor that as a unit test, that is definitely welcome, I'm not planning :)
Comment #12
penyaskitoIs this on purpose?
Comment #13
gábor hojtsyYeah its just renamed files, but my git diff is not properly configured to show they are renamed. While the pattern used would support a .po file like drupal-8.0.hu.po, it should be testing more realistic versions like drupal-8.0.0-beta2.hu.po.
Comment #14
vijaycs85leave the rename part with me. I'm working on unit testing and I can see the rename part properly in my local:
Comment #15
vijaycs85Updating with unit tests..
Comment #16
penyaskitoI love those unit tests!
I would love a comment here so we know what the regex+ternary are doing three months from now.
Contains.
That's very clever, vijaycs85++
AFAIK, we support de.po. Can we add this case?
Comment #17
gábor hojtsy@penyaskito: yeah, we don't support de.po, look at the regex you quoted in your first point :)
Comment #18
penyaskitoAs exporting translation use the "hu.po" pattern, should we allow it on importing?
Comment #19
sutharsan commentedIncluded #16 comments (1 and 2).
@penyaskito, this code is only ment to be used at installation:
During installation we only have drupal-core, that's where the "drupal-" prefix comes from. Do not mistake this with importing translation files by the admin via the interface. There any file name is permitted.
Comment #20
gábor hojtsy@Sutharsan: the interdiff seems to be as big as the diff?! Hard to figure out what changed.
Comment #22
sutharsan commentedThis is the correct interdiff.
Comment #23
sutharsan commentedAnd this is the correct patch. I missed the files in simplenews/test/files/translations.
Comment #24
gábor hojtsyI don't get the change of not requiring a number after drupal- because later on in the code we require the number to the be the same as the major number of the local install no? Is that not the case? If we don't ensure there is a number there, then there may be false positives.
Comment #25
sutharsan commentedNot sure either, was introduced in #6.
Comment #26
vijaycs85As per regex, it is either number or string or dot(.) or hyphen (-)to represent release version. so, I guess the comment can be updated to:
Comment #27
gábor hojtsyOk, lol, I made the version number change in #6 :D So looking at how we use this, we don't care for the version number for these files, so it does not actually matter. We are fine, the regex is good. The docs improvements would be nice from #26 :) Otherwise this looks good IMHO.
Comment #28
sutharsan commentedChanged documentation.
I guess this is what @vijaycs85 meant. In #26 the language wildcard is missing when no langcode is provided.
Comment #29
gábor hojtsyLooks good to me.
Comment #30
webchickExcellent work!
Committed and pushed to 8.x. Thanks!
Comment #32
gábor hojtsyThanks!