avatar imanickam
imanickam
15 Nov 2021

Steps to reproduce the issue

This is not an issue. Rather it is a suggestion for improvement.

At present the Language Selection in Joomla Installer displays only the nativeName in the list. This makes language names to display in different places not alphabetically by [English] name. This is true especially for language names that do not contain Latin characters. For example, Spanish would appear immediately after English as the native name for Spanish is Español. You can also notice other language such as Tamil (with native name தமிழ்)is listed after the English alphabet names.

Suggestion is to show the language name (ie English Name) along with native name in the list and the list sorted in the language name. This would help to see the languages alphabetically in English. In addition, it would help to find the language easily.

Expected result

Notice the language names sorted alphabetically in English along with their native name.

screen shot 2021-11-15 at 08 04 25

Actual result

Notice the language names sorted alphabetically by their native name.

screen shot 2021-11-15 at 08 02 37

System information (as much as possible)

Joomla! 4

Additional comments

To test the implementation, I have modified two files as shown below:

(a) File: \installation\src\Form\Field\Installation\LanguageField.php

Original code:

		// Get the list of available languages.
		$options = LanguageHelper::createLanguageList($native);

Modified code:

		// Get the list of available languages.
		$options = LanguageHelper::createLanguageListInstall($native);

(b) File: \libraries\src\Language\LanguageHelper.php

New Code:

	public static function createLanguageListInstall($actualLanguage, $basePath = JPATH_BASE, $caching = false, $installed = false)
	{
		$list      = array();
		$clientId  = $basePath === JPATH_ADMINISTRATOR ? 1 : 0;
		$languages = $installed ? static::getInstalledLanguages($clientId, true) : self::getKnownLanguages($basePath);

		foreach ($languages as $languageCode => $language)
		{
			$metadata = $installed ? $language->metadata : $language;

			$list[] = array(
				'text'     => $metadata['name'] . " | " . $metadata['nativeName'] ?? $metadata['name'],
				'value'    => $languageCode,
				'selected' => $languageCode === $actualLanguage ? 'selected="selected"' : null,
			);
		}

		return $list;
	}

Note:
(i) For the new function, I just mimicked the existing function createLanguageList ()
(ii) Probably this could be implemented more efficiently
(iii) Of course, languages' [English] names have to be standardized in the languages' xml files where needed
(iv) This could be implemented in Joomla! 3, if desired

avatar imanickam imanickam - open - 15 Nov 2021
avatar brianteeman
brianteeman - comment - 15 Nov 2021

I raised this a long long time ago so I 10000% agree

avatar HLeithner
HLeithner - comment - 15 Nov 2021

I raised this a long long time ago so I 10000% agree

And you pr got rejected? If you create a pr I would support it.

avatar brianteeman
brianteeman - comment - 7 Dec 2021

Probably should display the native name here as well

image

avatar brianteeman
brianteeman - comment - 23 Aug 2022

I converted this into a pull request #38573

avatar zero-24 zero-24 - change - 23 Aug 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-08-23 18:33:44
Closed_By zero-24
Labels Removed: ?
avatar zero-24 zero-24 - close - 23 Aug 2022
avatar zero-24
zero-24 - comment - 23 Aug 2022

Cloding here as there is a PR thanks Brian

Add a Comment

Login with GitHub to post a comment