[add] languages well displayed on config page #480

This commit is contained in:
Nicolas Lœuillet 2014-02-21 15:24:33 +01:00
parent 0a022f9a39
commit c9bd17a100
3 changed files with 17 additions and 4 deletions

View File

@ -23,6 +23,19 @@ class Poche
private $currentLanguage = '';
private $notInstalledMessage = array();
private $language_names = array(
'cs_CZ.utf8' => 'čeština',
'de_DE.utf8' => 'German',
'en_EN.utf8' => 'English',
'es_ES.utf8' => 'Español',
'fa_IR.utf8' => 'فارسی',
'fr_FR.utf8' => 'Français',
'it_IT.utf8' => 'Italiano',
'pl_PL.utf8' => 'Polski',
'ru_RU.utf8' => 'Pусский',
'sl_SI.utf8' => 'Slovenščina',
'uk_UA.utf8' => 'Український',
);
public function __construct()
{
if ($this->configFileIsAvailable()) {
@ -333,7 +346,7 @@ class Poche
$current = true;
}
$languages[] = array('name' => $language, 'current' => $current);
$languages[] = array('name' => $this->language_names[$language], 'value' => $language, 'current' => $current);
}
return $languages;
@ -751,7 +764,7 @@ class Poche
$actualLanguage = false;
foreach ($languages as $language) {
if ($language['name'] == $_POST['language']) {
if ($language['value'] == $_POST['language']) {
$actualLanguage = true;
break;
}

View File

@ -69,7 +69,7 @@
<label class="col w150p" for="language">{% trans "Language:" %}</label>
<select class="col" id="language" name="language">
{% for language in languages %}
<option value="{{ language.name }}" {{ language.current ? 'selected' : '' }}>{{ language.name }}</option>
<option value="{{ language.value }}" {{ language.current ? 'selected' : '' }}>{{ language.name }}</option>
{% endfor %}
</select>
</div>

View File

@ -69,7 +69,7 @@
<label class="col w150p" for="language">{% trans "Language:" %}</label>
<select class="col" id="language" name="language">
{% for language in languages %}
<option value="{{ language.name }}" {{ language.current ? 'selected' : '' }}>{{ language.name }}</option>
<option value="{{ language.value }}" {{ language.current ? 'selected' : '' }}>{{ language.name }}</option>
{% endfor %}
</select>
</div>