Problem/Motivation
Country list is not correctly sorted when it's localized with accents. Especially if the first letter has an non ASCII letter they are sort to the end.
e.g. this Turkish country list:
Almanya
Birleşik Krallık(İngiltere)
Fransa
Portekiz
Türkiye
Yunanistan
İspanya
İsviçre
İtalya
should be:
Almanya
Birleşik Krallık(İngiltere)
Fransa
İspanya
İsviçre
İtalya
Portekiz
Türkiye
Yunanistan
e.g. this German country list:
Belgien
Frankreich
Schweden
<strong>Österreich</strong>
should be:
Belgien
Frankreich
<strong>Österreich</strong>
Schweden
Steps to reproduce
When I set my default language to german
Go to de/admin/config/regional/settings See that Österreich appears at the bottom
Proposed resolution
TBA
Remaining tasks
See #124
User interface changes
API changes
Data model changes
Release notes snippet
Comments
Comment #2
sleitner commentedComment #3
sleitner commentedComment #4
sleitner commentedComment #5
sleitner commentedComment #6
sleitner commentedComment #7
sleitner commentedComment #8
longwaveThe proposal looks correct to me, thank you for working on this.
We need to add backward compatibility here in case someone has extended the class and calls this constructor without the arguments.
It would also be good to add a test to prove that the countries are sorted as expected, if possible.
Comment #9
sleitner commentedComment #10
sleitner commentedComment #11
sleitner commentedBackward compatibility and test are added
Comment #12
sleitner commented@longwave do the recent changes meet your requirements for tests and backward compatibility?
Comment #13
longwaveA few review points, nothing big just some questions/notes:
Usually we just declare constructors on one line instead of breaking them like this.
As this is a public method is it worth keeping this natcasesort anyway, so callers that use the method directly still get the previous sort order?
This will be called every time a sort comparison is done, is there a way to cache this outside of the compare function?
Here you can use the spaceship operator:
Comment #14
sleitner commentedComment #15
sleitner commented@longwave I implemented your suggestions
Comment #16
longwaveThank you, this all looks good to me now.
Comment #17
sleitner commentedDo we need a D10 patch to get this issue fixed?
Comment #18
quietone commented@sleitner, yes this needs a patch for 10.0.x. The current patch applies to D10 so I started a test on D10.
Comment #19
quietone commented@sleitner, thanks for fixing this!
I came back and had a look at the patch.
The patch has a deprecation, adding tag for a change record.
These if blocks can be a bit simpler and could follow existing examples in core. Such as https://git.drupalcode.org/project/drupal/-/blob/9.5.x/core/modules/file....
According to the deprecation policy these need a reference to the change record. See @trigger_error() format
The indentation for the
// cSpell:disableand it can be replaces with// cSpell:disable-next-line, and therefore dropping the second 'cspell' line.Comment #20
sleitner commentedComment #21
sleitner commentedComment #22
sleitner commented@quietone the three changes are in the patches for D9 and D10
Comment #24
sleitner commentedAny news on this issue? Updated references to 9.5
Comment #25
smustgrave commentedI can review this. Can you provide a tests-only patch and exactly where you are seeing this issue?
Comment #26
sleitner commentedThe test-only patch is attached. The country list appears in /admin/config/regional/settings and in every other country list.
Comment #28
sleitner commentedPlease review. The test are intended to fail. The complete patch in #24 solves the issue.
Comment #29
smustgrave commentedTested out
The summary is clear and accurate.
Verified the issue existed (see before_patch)
Verified the issue was fixed with the patch (see after_patch)
The tests-only patch failed showing the test case is valid.
And the change record is attached
Looks good!
Comment #31
sleitner commentedReupload patches from #24
Comment #32
sleitner commentedComment #33
catchThis is a bit borderline for whether it should land in 9.5.x or not (bug fix, but also a new deprecation in a service), however we definitely shouldn't be deprecating in 9.5.x for removal in 10.0.x unless it's a module being removed or other specific circumstances. Given the bug itself is quite minor, let's update to deprecate in 10.1.0 for removal in 11.0.0 (discussed this with @quietone and @xjm in slack).
Comment #34
quietone commentedAlso, this has the 'Needs change record' tag. That needs to be done as well, before this is RTBC.
Comment #35
sleitner commented@catch, @quietone, @xjm: from the programmers point of view it might be a minor problem. From a site builders point of view it is not minor because you have to discuss this with the every client for every country list, every country dropdown and every sorted view in every website for every new version. Especially if the clients country name is listed as last.
We started to build manual country lists and textfields as a workaround as I'm not a friends of long-term patching against core.
I can understand if the deprecation will not be removed in 10.0.x because it might be too short term. But not fixing the bug for another year is very anoying for site builders with multilingual and multicountry websites.
Comment #36
smustgrave commentedI have to agree with @sleitner on that.
Can try and update for the deprecation today but not sure what's needed for the change record.
Comment #37
xjmI perhaps should have said "not major" instead of "minor". It is definitely a usability bug -- sorry for implying otherwise. :) My reasoning for "normal" priority instead of "major" is that adding a new language is a rare task rather than a daily one. (Also I think you can find the language by clicking on or tabbing to the select box, and typing the first letter of the localized language name? That's what I always do for my own country in fields that list all countries.)
TLDR, it doesn't have implications for security, data integrity, backward compatibility, the upgrade path, etc., so it's not critical to backport. (Note that all minor-only issues will be 10.1.x-only in about a month anyway.) Thanks!
Comment #38
xjmComment #39
sleitner commented@xjm: selecting a new language in the backend is not my biggest problem, too. As soon as the country names appear in the frontend as a drop down in a form or a view sorted by country, that is my main focus on this issue.
If the website visitor have to search his country name too long, he/she will not buy anything and will go to the competitor.
Views sorted by country name in the front end which are not sorted correctly are not the best user experience either (see screenshots).
Comment #40
ravi.shankar commentedAdded a patch for D9 with changes as mentioned in comment #33. Still need works for other things.
Comment #41
smustgrave commentedI can take a crack at the change record but would would it entail exactly?
Comment #42
xjmInstructions for writing a change record (CR) draft: https://www.drupal.org/community/contributor-guide/task/write-a-change-r...
Comment #43
sleitner commentedComment #44
smustgrave commentedSorry got distracted and forgot about that change notice. Took a look and it makes sense to me. The before and after really helped. Moving back to RTBC
Comment #45
xjmAs we mentioned before, this issue needs to be targeted for 10.1.x, not 9.5.x. This release management decision was posted in #33. Now that 9.5.0-beta1 and 10.0.0-beta1 have been released, this is actually true of all issues that require changes like new APIs that require a minor release.
It may be that the "Drupal 9" patch in #40 will actually work for 10.1.x. I will queue a test.
Thanks everyone!
Comment #46
xjmComment #47
longwaveComment #48
alexpottRather than have a new languageId property I think we should use an anonymous function here and then languageId can be a local variable. Less state on the object property.
Also this makes me realise that $this->countries is going to depend on the language ID so we need to cache by that. So $this->countries is going to need to change to $this->countries[$languageId] and we're going to need to change what we pass to the alter as well.
Why type content - I would have thought this is about the UI language. Well I guess it is going to depend on where it is called from. Maybe we're going to need to allow the user to pass this in and have a sensible default.
Comment #49
sleitner commented@alexpott anonymous function and language type are implemented. Please review
Comment #50
sleitner commentedComment #51
sleitner commentedI think we have to change the way how the country list is translated. getStandardList() needs a language ID parameter, because t() does not generate different language translations without a langcode parameter. Please review
Comment #52
smustgrave commentedConfirmed the tests fail without the fix.
They pass with the fix.
To me the fix matches the issue summary.
When I set my default language to german
Go to de/admin/config/regional/settings I see that Österreich appears to the correct spot. Updating issue summary also.
Change record is added for deprecation call
+1 from me.
Comment #53
xjmThanks @sleitner and @smustgrave. It sounds like the change in #51 needs test coverage.
Since it also requires moving away from the normal best practice of only having a string literal as the first parameter of
t(), I think we should have a translation subsystem maintainer signoff on that in particular (and probably the whole implementation overall). Assigning to Gábor for that.Comment #54
xjmFixing credit attribution.
Comment #55
xjmForgot this tag for test coverage for the change required in #51.
Comment #56
gábor hojtsyThanks for working on this! I agree its a bug definitely worthy of resolving!
Also thanks for tagging me (subsystem maintainer). I think the implementation to sort it using the transliterated version probably makes sense. At least I don't know a better solution either :D
For removing the t() on the country names, it seems to be for "cosmetic reasons", given that the additional language code argument is added and it would look odd to repeat it in all
t()s. However, if we are to remove thet()s from all the country names, Translation template extractor will not find the source country name list and so Drupal 10.1 onwards would not have a country list as part of its translatable strings on localize.drupal.org, etc. While we could hardwire the country list in Translation template extractor to overcome this, I don't think that is quite future proof as it would need to be maintained to be in sync and verioned alongside Drupal. I think that is a comparatively large undertaking as opposed to updating the already repetitivet()calls to also repeat the prepared array argument (and update the existing format checking test to make sure it is repeated as such for all country names). That would keep country names sourced from the source code rather than require a potentially fragile workaround.Comment #57
gábor hojtsyComment #58
sleitner commentedAdded a translation test and repetitive
t()with options is used again.Comment #59
sleitner commentedComment #60
sleitner commentedAdded a translation test and repetitive t() with options is used again.
Comment #61
smustgrave commentedSeems the changes from 55 + 56 have been addressed
Reviewed the change record and seems straight forward.
Think this would be a good one to finally get in.
Comment #62
xjmThanks for carrying this forward. I reviewed again and found mostly small stuff, but one potentially serious bug (see point 6 below).
This code can be simplified. We can have
The inline comment here does not seem to be describing what the next line is actually doing. Can we make it actually describe the purpose of setting the translation options?
Also, I think the variables should be
$language_idand$translation_optionsunder current policy. The rest of the local variables in this class use snake case, and we currently don't allow mixing snake and camel case in the same file. #2678238: Remove prohibition on mixing snake_case and camelCase at least for constructorsThe new parameter can have a nullable string typehint:
?stringI think this line removal is out of scope?
Same issue here about snake_case vs. camelCase.
Unless I'm mistaken,
$translateOptionsis not defined in this scope yet, so this code seems broken. Is there test coverage for this? Has it been manually tested?Nit: Tests.
Should it also have
@covers?This could be typehinted.
This isn't a sentence. Maybe "Tests the translation of country names"?
Our best practice is to omit assertion messages. The last one about Zimbabwe could be moved to an inline comment above the assertion. The first two messages could be omitted since they are self-explanatory from the code.
Finally, I think the change record should be about the whole change (i.e., "Country names are now sorted by the transliterated translation of the country name, rather than the English name") and the constructor parameter additions are incidental changes that we can mention.
Thanks!
Comment #63
sleitner commented3.
?stringwould allow NULL as parameter, but not no parameter.4. phpcs:
6. The variable name is written to the CountryManager.php, not the value of the variable:
'AC' => t('Ascension Island', [], $translation_options),I tested update-countries.sh manually.
9. There is a typehint:
@var \Drupal\user\Entity\UserChange record is updated.
Comment #64
sleitner commented3.
?stringwould allow NULL as parameter, but not no parameter.4. phpcs:
6. The variable name is written to the CountryManager.php, not the value of the variable:
'AC' => t('Ascension Island', [], $translation_options),I tested update-countries.sh manually.
9. There is a typehint:
@var \Drupal\user\Entity\UserChange record is updated.
Comment #65
smustgrave commentedLooking at the points #62 and the points have been addressed and the comments in #64 help answer why some remain.
Only one I'll lean on xjm about is
Comment #66
quietone commented@sleitner, thanks for updating the patch. The duplicated comments in #63 and #64 caught me by surprise.
The structure of the array has changed and this is no longer true.
The description should explain that this is now an array of country code, country name pairs keyed by language code.
This also needs to be updated.
Unnecessary change
I'd rather we didn't use the abbreviation, e.q. There is an issue to remove them #2637336: Replace i.e. and e.g. with English words in /core/includes and /core/misc directory
This can be removed. The one before 'Spain'.
Thanks for the updates to the change record. I think that the intention of the last paragraph in #62 has not been met, that is the focus should be on what the change means to the user/developer. Having the changes to code does need to say we just a need a bit to say when this change will be seen and when a developer needs to change code. At lest, that is what I think.
Comment #67
xjmComment #68
sleitner commentedComment #69
sleitner commented@quitone, the change record is updated,too
2)
Get an array of all two-letter country code => country name pairs.in contrast to 1) the return value structure and the default content did not change.Comment #70
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #71
sleitner commentedI'm quite sure that PHPstan simply does not understand the made changes.
84 Function t invoked with 3 parameters, 1 required.The third parameter is needed to specify the requested language.
Comment #72
sleitner commentedComment #73
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #74
nod_Same issue with the bot as before, excluding this issue from the list
Comment #75
smustgrave commentedFrom what I can see all the points have been addressed by @sleitner so lets try this again.
Comment #76
nod_Comment #78
longwaveCommitted and pushed to 10.1.x, thanks! Also published the change record.
Comment #79
chi commentedAdded follow-up.
Comment #80
tr commentedI have to say that this commit is quite disruptive to any modules that use, enhance, or decorate the
country_managerservice - this is most certainly not a "minor" change. Specifically it changes the API of the service in a way that's not backwards compatible.In addition to the break described in #3344424: Add tests for hook_countries_alter(), this patch neglected to change
CountryManagerInterface.The core
country_managerservice is provided by theCountryManagerclass.CountryManager implements CountryManagerInterface.This patch changes the signature of one of the implemented methods without actually modifying the
CountryManagerInterface. This is wrong, so I've reopened this issue.Additionally, if
CountryManager::getStandardList()is to be a primary method on the service, it should be described in the interface (it's not currently).The change record is also not very good, because it doesn't mention the service or the class that is being modified, and refers to the class as a "form", which it is not. I have done a quick edit of that change record so that searches can more easily find this change to the
country_managerservice, but the change record should be properly reviewed to ensure consistency with the changes here.May I ask why the order of the countries in English changed? What is the reason for this? If the order has to change, that should be mentioned in the change record, and any countries that have been moved in the list should be called out so we don't have to compare the old list of 258 countries with the new list of 258 countries to try to figure out what has changed.
And why are we involving transliteration here? The sorting of countries in any specific language does not require transliteration to a different character set - the sorting should be done in that language's character set.
Comment #82
longwaveRolled this back for now, to handle the change of values in the hook and the concerns raised in #80.
Comment #83
andypostThank you! Makes sense to incorporate test and fix from #3344424: Add tests for hook_countries_alter() and close it
Comment #84
sleitner commentedCountryManagerInterfaceand the changes of #3344424: Add tests for hook_countries_alter() are included in the patch. I moved thetestCountryManagerSorttest to the kernel tests.The order did not change, only the parameter
$translation_optionswas added to each line.ok, it solved the problem for most languages, but not for all. Sorting it by the language' character set makes it even more disruptive by using
ext-intlCollator.Comment #86
tr commentedWhile the order of the countries in the array declaration inside
getStandardList()seems to be the same, that's not important, because the declaration order is prior to the sort.What is important is that the order of the countries returned by
getList()DID change, because it is sorted differently after the patch. And that is, of course, one of the main things the patch was intended to do! I know this because my test cases broke, and that led me to this issue.You can see this change in order by running the following script before and after the patch:
drush php-eval '$array = \Drupal::service("country_manager")->getList(); print_r(array_map(function ($country) { return (string) $country; }, $array));'Specifically, look at
[AX] => Åland Islands, which shows up at the bottom of the list (element 257, numbered 0-257) before the patch and shows up as number two in the list (element 1, numbered 0-257) after the patch. There seem to be other changes as well, but as I said scanning through 258 countries to see exactly what changed is a pain.When transliteration is done, Å -> A, so Åland Islands gets sorted and put somewhere in the middle of all the countries that begin with "A". But this is not correct. "Å" is a distinct letter, so all the countries that begin with "Å" should be grouped together, and not interleaved with all the countries that begin with "A". I would also expect all these "Å" countries to appear in the list BEFORE all the "A" countries, as that is the accepted way (in English) to alphabetize words that begin with numerals, special characters, etc.
Now this is not that apparent with "Å" countries in English, because there is only one of them. But the same situation happens with other languages. To use your example, "Ö" in German is a different letter than "O", so they should be listed in separate groups and not interleaved together like they would be with transliteration involved.
I don't think transliteration is the right approach, because transliterating loses the information that these non-native characters are distinct characters.
There are many authorities on how to alphabetize - in English for example I would refer to the Chicago Manual of Style. What this patch seems to do is to invent a brand-new "Drupal" style of alphabetizing, which seems wrong. We are already inventing and maintaining our own list of countries that does not 100% agree with any standard, why are we working so hard to invent a new solution to alphabetizing as well?
To implement this new feature of being able to obtain the country list in a specific language, I would suggest that, instead of adding an argument to
getList(), a NEW method should be declared for getting the list. Something likeCountryManagerInterface::getLocalizedList($language)where$languageis a language ID. This would still involve injecting thelanguage_managerservice, though. Off the top of my head I don't know if that is an allowable change for a minor-point release, but I do know if this is done it will make my D10.0 module incompatible with D10.1.And to bring up another point, hooks are not how we alter services in Drupal. Symfony has perfectly good mechanisms for altering services, which we document in Drupal and use elsewhere. This
hook_countries_alter()hook seems to be an artifact of the early porting days when this code was initially moved from D7 procedural code, and it was never touched after that even after everyone became more familiar with services and how we wanted to implement them in Drupal. There is no need to define a hook in order to alter this service. And indeed, since the altering function is not described inCountryManagerInterface(see #2487351: Not inheriting parent documentation for CountryManager::getList()) I will argue that this alter hook is not part of the publiccountry_managerservice API and should be deprecated here and dropped for D11. In any case, the hook is not part of the current API and if I override the service in the standard manner I will lose the hook functionality - having two standard ways to alter services is prone to error.Comment #87
longwaveI think I agree that
hook_countries_alter()should be deprecated, but let's do that in a separate issue, rather than expand the scope of this one.Comment #88
adeshsharma commentedComment #89
adeshsharma commentedComment #90
sleitner commented@TR I don't want to reinvent the wheel. My intention is to sort lists like the country list and e.g. the content types list in the same way as the content/node list on a multiligual website in Drupal. The content list sorting in Drupal depends on the database, which usually uses a general collation e.g.
utf8mb4_general_ciin MySQL . This results in a sorted list of titles (country names): Afghanistan, Åland Islands, Albania, Oman, Österreich, Osttimor. The non-ascii characters are not send to the end of the list.Ålandis Swedish/Finnish. The Swedish and Finnish rule is to put "Å" after "Z". "Å" is also use in Danish and Norwegian, but the order of characters after "Z" is not the same as in Swedish and Finnish, and "Aa" is equivalent to "Å".There are two different rules in German-German how to sort a list, depending on if it is a list of names in phone books or words in a dictionary. If its a phone book name list "Ö" is treated as "Oe" (DIN 5007-2). If it is a dictionary or another list "Ö" is treated as "O" (DIN 5007-1). (see https://de.wikipedia.org/wiki/Alphabetische_Sortierung#Deutschland)
In Austrian-German phone books these rules are used: name lists "Ä" would be after "Az" (Österreichische Sortierung), city name lists "Ä" after "Z" (Country names are not sorted like city names), other lists: "Ä" is treaded as "A" (DIN 5007-1). (see https://de.wikipedia.org/wiki/Alphabetische_Sortierung#%C3%96sterreich)
For Swiss-German I did not find special rules so quickly.
In Turkish non-ASCII characters are sorted after their bare character, not at the end of the list.
My new proposal in #84 uses the
Collatorclass of thePHP intlextension (https://www.php.net/manual/en/class.collator.php), which uses the ICU library (https://icu.unicode.org/) . If you use Swedish as language,Ålandis at the end of the list. With English and German it is between "A" countries. In French it is "Îles Aland".Comment #91
sleitner commented#88 @adeshsharma the tests are missing
Comment #92
longwave@sleitner Thank you for working on this. At present Drupal doesn't require the intl extension and I don't think we can add that requirement here. It might be possible to add a dependency on symfony/polyfill-intl-icu instead, which looks to provide the Collator class for environments that do not have the intl extension - does your code work with that? But this is still quite a big change and will require wider review.
Comment #93
sleitner commented@longwave Thanks, now I know why I do not find a Collator in current Symfony, because it is hidden in the polyfills.
I will take a look at it tomorrow. Possibly we do not need language manager to make it a bit easier.
Comment #94
sleitner commented@longwave
symfony/polyfill-intl-icudoes not helps us, because it is limited to the "en" locale. Any suggestions?Comment #95
sleitner commentedPlease review this patch which uses PHP
intlextension forCollatorclass, becausesymfony/polyfill-intl-icuisenlocale/english only. PHPintlextension would help sorting other lists in Drupal (e.g. ConfigEntity based lists) as well.Language Manageris not used anymore, because the language id parameter is mandatory for the newgetLocalizedListmethod. The position of these countries changed ingetLocalizedListcompared togetList:Åland Islands, Côte d’Ivoire, Northern Mariana Islands, Réunion, São Tomé & PríncipeThe
getListmethod works in the original way, no country position changed. Thehook_countries_alter()is called only ingetList, because an additional parameter would be needed for the language id ingetLocalizedList.Comment #97
sleitner commentedComment #98
sleitner commentedComment #99
sleitner commentedPlease review this patch which uses
symfony/polyfill-intl-icu. If phpintlis not installedenlocale/english is used only.Language Manageris not used anymore, because the language id parameter is mandatory for the newgetLocalizedListmethod. The position of these countries changed ingetLocalizedListcompared togetList:Åland Islands, Côte d’Ivoire, Northern Mariana Islands, Réunion, São Tomé & PríncipeThe
getListmethod works in the original way, no country position changed. Thehook_countries_alter()is called only ingetList, because an additional parameter would be needed for the language id ingetLocalizedList.Comment #100
longwaveThis doesn't need to be added here, only in core/composer.json.
This is hard to read, this should probably just be one line.
Same
Can use assertLessThan here.
@TR does this latest patch fix all the concerns you had with the previous version?
Comment #101
longwaveThis also needs a release note given that we are adding a new dependency and that Intl extends this functionality further.
I also wonder if we should add the Intl extension to the
suggestsection of core/composer.json?Comment #102
sleitner commentedComment #103
sleitner commentedComment #105
sleitner commentedComment #106
sleitner commented@longwave change record is updated.
To prevent
MethodArgumentValueNotImplementedexception inCollator, language_idenis used ifintlextension is not installed.Comment #107
longwaveTagging for framework manager review, as we are adding a new soft dependency on the intl extension and we need an opinion as to whether this is the right direction.
Also tagging for release manager review; I don't see any issue with the new dependencies but would like a second opinion there too.
Comment #108
catchDo we need a hook_requirements() somewhere encouraging people to install the intl extension (maybe in locale module?).
I was also wondering if we could just skip the sorting completely if the locale is 'en' and not add the symfony polyfill in that case, but it's probably cleaner to have less code paths.
Don't really see a problem with the soft dependency, and also can't think of an alternative.
Comment #109
catchUntagging for release manager review since both me and longwave think this is OK in principle.
One more thought - should locale module decorate the country manager and handle the sorting? Probably not worth it though for the complexity that would add.
Comment #110
sleitner commentedAdded a warning and an ok message to
hook_requirements()in/core/modules/locale/locale.installComment #112
sleitner commentedComment #113
sleitner commentedComment #115
sleitner commentedComment #116
longwave"English" should be capitalised.
We can use typehints for new properties.
What if someone has already extended this class and replaced this method? https://3v4l.org/0WTuR
We can use a typed argument and a return type here.
Comment #117
sleitner commentedLots of changed lines, but now the old methods remain.
Comment #119
sleitner commentedComment #120
sleitner commentedComment #121
sleitner commented@longwave all four #116 issues had been fixed. Now the old methods remain intact.
Comment #122
smustgrave commentedGoing to go ahead and mark this to keep it moving forward. @catch as a release manager did a review #109 but he's also a framework manager. Will leave the tag if we think a separate framework manager is needed but think we should be good.
Comment #123
alexpottNone of these changes affect the logic of the change therefore leaving at RTBC.
Comment #124
alexpottI think there are some tensions with the existing getList() method...
It has an alter hook...
and the new method...
So if you alter the first one you don't get to alter the other. I don;'t think the best solution is to add another alter hook. I think the best solution would be to able to execute code in a different language contexts (there is an issue for this but I'm having trouble to find it) - so we can call getList() without having to add a hook or do anything particularly special.
This is necessary so that we get translations from localise.drupal.org - but that makes the test fragile. We should be setting up a few translations in the test rather than doing this.
Comment #126
sleitner commented@alexpott are you searching for this issue #2410579: Allow to change the current language?
Comment #127
sleitner commentedIt seems to me that we have to delegate this to the custom modules as long as we do not want to break anything.
In the country module the country lists are now sorted correctly. It does not cover the default country settings in the core regional settings.
Comment #128
sleitner commentedComment #129
quietone commentedWhat is this issue posptoned on?
Comment #130
acbramley commentedThis came up in the Bug Smash PMNMI triage. It looks like we haven't had a response to why this issue is postponed. Is someone able to update this issue on whether it is still something that needs work?
Comment #132
quietone commentedI did some testing on 11.x and confirmed the country list is not sorted per language. Therefor, I converted the latest patch to an MR and updated the functional test so that it tests the displayed data. I also noted that the new method is not called when viewing the country list at admin/config/regional/settings.
The related issue, #3403443: Sort country names using Collator, uses PHP Colllator::sort. Maybe this should do the same.
Comment #133
quietone commented