[FEATURE] Allow user-defined additional backend languages
authorXavier Perseguers <xavier@typo3.org>
Wed, 7 Sep 2011 17:16:29 +0000 (19:16 +0200)
committerXavier Perseguers <xavier@typo3.org>
Wed, 7 Sep 2011 20:16:55 +0000 (22:16 +0200)
At the moment, any language may be used for Frontend output. But in Backend, the list
of supported languages is hardcoded at various places. This prevents additional
languages to be defined locally, for instance when translating TYPO3 into a new
language, before it gets officially supported by the Core.

Change-Id: I66cd9149c860746356e249c778a5303211076d37
Resolves: #29513
Releases: 4.6
Reviewed-on: http://review.typo3.org/4830
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
Reviewed-by: Dominique Feyer
Tested-by: Dominique Feyer
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
typo3/sysext/setup/mod/index.php

index d5835ec..7a37872 100755 (executable)
@@ -776,15 +776,20 @@ class SC_mod_user_setup_index {
                        // traverse the number of languages
                /** @var $locales t3lib_l10n_Locales */
                $locales = t3lib_div::makeInstance('t3lib_l10n_Locales');
                        // traverse the number of languages
                /** @var $locales t3lib_l10n_Locales */
                $locales = t3lib_div::makeInstance('t3lib_l10n_Locales');
-               foreach ($locales->getLocales() as $language) {
-                       if ($language != 'default') {
-                               $languageValue = $GLOBALS['LOCAL_LANG']['default']['lang_' . $language][0]['source'];
-                               $localLabel = '  -  ['.htmlspecialchars($languageValue) . ']';
-                               $unavailable = (is_dir(PATH_typo3conf . 'l10n/' . $language) ? FALSE : TRUE);
-                               if (!$unavailable) {
-                                       $languageOptions[$languageValue] = '<option value="'.$language.'"'.($GLOBALS['BE_USER']->uc['lang'] == $language ?
-                                               ' selected="selected"' : '') . ($unavailable ? ' class="c-na"' : '') . '>' .
-                                               $GLOBALS['LANG']->getLL('lang_' . $language, 1) . $localLabel . '</option>';
+               $languages = $locales->getLanguages();
+               foreach ($languages as $locale => $name) {
+                       if ($locale !== 'default') {
+                               $defaultName = isset($GLOBALS['LOCAL_LANG']['default']['lang_' . $locale]) ? $GLOBALS['LOCAL_LANG']['default']['lang_' . $locale][0]['source'] : $name;
+                               $localizedName = $GLOBALS['LANG']->getLL('lang_' . $locale, TRUE);
+                               if ($localizedName === '') {
+                                       $localizedName = htmlspecialchars($name);
+                               }
+                               $localLabel = '  -  [' . htmlspecialchars($defaultName) . ']';
+                               $available = (is_dir(PATH_typo3conf . 'l10n/' . $locale) ? TRUE : FALSE);
+                               if ($available) {
+                                       $languageOptions[$defaultName] = '<option value="' . $locale . '"' . ($GLOBALS['BE_USER']->uc['lang'] === $locale ?
+                                               ' selected="selected"' : '') . '>' .
+                                               $localizedName . $localLabel . '</option>';
                                }
                        }
                }
                                }
                        }
                }