?
Related to # 4690
avatar dkanchev
dkanchev
15 Oct 2014

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)

avatar dkanchev dkanchev - open - 15 Oct 2014
avatar brianteeman brianteeman - change - 15 Oct 2014
Priority Low Medium
avatar brianteeman
brianteeman - comment - 15 Oct 2014

I can confirm this as I have seen it happen although I have been unable to replicate it

avatar brianteeman brianteeman - change - 15 Oct 2014
Status New Confirmed
avatar joomdonation
joomdonation - comment - 15 Oct 2014

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:

ksort($languages);
avatar nicksavov
nicksavov - comment - 16 Oct 2014

Thanks all! Could you submit a pull request for it? Here's a really easy way how:
http://docs.joomla.org/Using_the_Github_UI_to_Make_Pull_Requests

avatar nicksavov nicksavov - change - 16 Oct 2014
Labels Added: ?
avatar joomdonation
joomdonation - comment - 16 Oct 2014

OK. I made the PR. Please help testing it when you have time :).

avatar brianteeman brianteeman - change - 17 Oct 2014
Rel_Number 4690
Relation Type Related to
avatar brianteeman
brianteeman - comment - 17 Oct 2014

see #4690

avatar jissues-bot
jissues-bot - comment - 17 Oct 2014
avatar jissues-bot jissues-bot - close - 17 Oct 2014
avatar zero-24 zero-24 - close - 17 Oct 2014
avatar brianteeman brianteeman - change - 17 Oct 2014
Status Confirmed Closed
avatar jissues-bot jissues-bot - change - 17 Oct 2014
Closed_Date 0000-00-00 00:00:00 2014-10-17 00:19:52
avatar zero-24 zero-24 - change - 7 Jul 2015
Labels Added: ?

Add a Comment

Login with GitHub to post a comment