fixing language display in menu

This commit is contained in:
Benjamin Sonntag 2012-10-31 11:42:32 +00:00
parent cbab7dee96
commit 84a730d3c1
4 changed files with 14 additions and 2 deletions

View File

@ -115,7 +115,7 @@ if (isset($url) && $url) {
<?php
foreach($locales as $l) {
?>
<a href="?setlang=<?php echo $l; ?>"><?php __($l); ?></a>
<a href="?setlang=<?php echo $l; ?>"><?php if (isset($lang_translation[$l])) echo $lang_translation[$l]; else echo $l; ?></a>
<?php } ?>
<br />
<?php

View File

@ -6,7 +6,7 @@
<div class="menu-content" id="menu-lang">
<ul>
<?php foreach($locales as $l) { ?>
<li><a href="/login.php?setlang=<?php echo $l; ?>" target="_top"><?php __($l); ?></a></li>
<li><a href="/login.php?setlang=<?php echo $l; ?>" target="_top"><?php if (isset($lang_translation[$l])) echo $lang_translation[$l]; else echo $l; ?></a></li>
<?php } ?>
</ul>
</div>

View File

@ -1,5 +1,13 @@
<?php
$lang_translation=array(
"fr_FR" => "Français",
"en_US" => "English",
"es_ES" => "Español",
"it_IT" => "Italiano",
"de_DE" => "Deutsch",
);
function update_locale($langpath) {
$locales=array();
$file=file("/etc/locale.gen", FILE_SKIP_EMPTY_LINES);

View File

@ -383,6 +383,10 @@ if [ -x /usr/sbin/locale-gen ] ; then
echo "en_US.UTF-8 UTF-8" >>/etc/locale.gen
LOCALECHANGED=1
fi
if ! grep -q "^it_IT.UTF-8 UTF-8$" /etc/locale.gen ; then
echo "it_IT.UTF-8 UTF-8" >>/etc/locale.gen
LOCALECHANGED=1
fi
if [ "$LOCALECHANGED" ] ; then
locale-gen
fi