Menu

#61 Language codification name

Unstable (example)
closed
None
5
2014-04-21
2011-12-15
Fernando
No

Now when you select a language in the dropbox, appears the directory name (codification name). Is more friendly read the language name.

In loginform.include.php:

function getLanguages()
{
$path = "languages";
$dir_handle = @opendir($path) or die(_("Unable to open")." $path");
//echo "<option value=\"\"></option>";
while ($file = readdir($dir_handle))
{
if (!preg_match('#^\.#', $file) && is_dir("$path/$file"))
{
echo "<option value=\"$file\"";
if(strtolower($_SESSION['locale']) == strtolower($file))
echo " selected=\"selected\" ";
echo ">$file</option><br/>";
}
}
closedir($dir_handle);
}

Change the line:
echo ">$file</option><br/>";

And put:
echo ">" . getLanguageName($file) . "</option><br/>";

Where getLanguageName($file) is a function:

function getLanguageName( $file )
{
switch ($file) {
case "en_US.UTF-8":
return "English";
break;
case "es_ES.UTF-8":
return "Castellano";
break;
case "eu_ES.UTF-8":
return "Euskara";
break;
case "zh_CN.UTF-8":
return "Chinese";
break;
case "it_IT.UTF-8/":
return "Italian";
break;
default:
return "unidentified";
}
}

Discussion

  • mastacontrola

    mastacontrola - 2014-04-21
    • status: open --> closed
    • assigned_to: mastacontrola
    • Group: --> Unstable (example)
     
  • mastacontrola

    mastacontrola - 2014-04-21

    0.33 has this "codification" setup now.

     

Log in to post a comment.