Skip to content
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

Closed
dkanchev opened this issue Oct 15, 2014 · 6 comments
Closed

Sorting Joomla! available languages #4679

dkanchev opened this issue Oct 15, 2014 · 6 comments

Comments

@dkanchev
Copy link

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)

@brianteeman
Copy link
Contributor

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

@joomdonation
Copy link
Contributor

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);

@nicksavov
Copy link
Contributor

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

@joomdonation
Copy link
Contributor

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

infograf768 added a commit that referenced this issue Oct 16, 2014
Fix issue #4679: Sorting Joomla! available languages
@brianteeman
Copy link
Contributor

see #4690

@jissues-bot
Copy link

Set to "closed" on behalf of @brianteeman by The JTracker Application at issues.joomla.org/joomla-cms/4679

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants