-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sorting Joomla! available languages #4679
Comments
I can confirm this as I have seen it happen although I have been unable to replicate it |
If locale code are "en-GB", "fr-FR"..... (the name of XML files), I think simply add one line of code in ModLoginHelper would solve the issue:
|
Thanks all! Could you submit a pull request for it? Here's a really easy way how: |
OK. I made the PR. Please help testing it when you have time :). |
Fix issue #4679: Sorting Joomla! available languages
see #4690 |
Set to "closed" on behalf of @brianteeman by The JTracker Application at issues.joomla.org/joomla-cms/4679 |
Steps to reproduce the issue
Right now the Joomla! app uses a rather strange method to sort and display the available languages in the language drop-down menu on the Joomla! admin login page.
In the JLanguage class an SPL iterator (RecursiveIteratorIterator) is being used to get a list of all languages files. From this list it picks the xml files and parses them in order to get the language's metadata. However, that iterator outputs the list of files in their physical order they are stored on the drive. So on different envs depending on how the languages were installed the order could be literally random.
To reproduce the issue install languages and then modify the creation/modification dates of the XML files of the languages. The languages will be "sorted" in the drop down menu based on this information.
Expected result
The list of languages should be sorted based on the locale code and not based on the creation/modification date of the XML files.
Actual result
Right now the list is sorted based on the creation/modification date of the XML files.
System information (as much as possible)
CentOS 6
Apache 2.4
PHP 5.5.17
More info will be provided if it is needed.
Additional comments
One way to solve the issue is to sort the two-dimensional array based on the locale code before actually returning the results and displaying them on the site. The function we're talking about here is createLanguageList:
public static function createLanguageList($actualLanguage, $basePath = JPATH_BASE, $caching = false, $installed = false)
The text was updated successfully, but these errors were encountered: