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 <?php
foreach($locales as $l) { 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 } ?> <?php } ?>
<br /> <br />
<?php <?php

View File

@ -6,7 +6,7 @@
<div class="menu-content" id="menu-lang"> <div class="menu-content" id="menu-lang">
<ul> <ul>
<?php foreach($locales as $l) { ?> <?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 } ?> <?php } ?>
</ul> </ul>
</div> </div>

View File

@ -1,5 +1,13 @@
<?php <?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) { function update_locale($langpath) {
$locales=array(); $locales=array();
$file=file("/etc/locale.gen", FILE_SKIP_EMPTY_LINES); $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 echo "en_US.UTF-8 UTF-8" >>/etc/locale.gen
LOCALECHANGED=1 LOCALECHANGED=1
fi 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 if [ "$LOCALECHANGED" ] ; then
locale-gen locale-gen
fi fi