1 |
--- smeserver-sme7admin-1.1.1/root/etc/e-smith/web/functions/sme7admin.detect_locales_regexp 2009-03-16 19:26:29.000000000 +0100 |
2 |
+++ smeserver-sme7admin-1.1.1/root/etc/e-smith/web/functions/sme7admin 2009-03-16 19:32:55.000000000 +0100 |
3 |
@@ -92,30 +92,16 @@ |
4 |
my $i18n = new esmith::I18N; |
5 |
my $http_lang = $i18n->preferredLanguage( $ENV{HTTP_ACCEPT_LANGUAGE} ); |
6 |
|
7 |
-if ($http_lang =~ /^be.*/) {$http_lang="be_BY";} |
8 |
-elsif ($http_lang =~ /^da.*/) {$http_lang="da_DK";} |
9 |
-elsif ($http_lang =~ /^de.*/) {$http_lang="de_DE";} |
10 |
-elsif ($http_lang =~ /^el.*/) {$http_lang="el_GR";} |
11 |
-elsif ($http_lang =~ /^es.*/) {$http_lang="es_ES";} |
12 |
-elsif ($http_lang =~ /^fr.*/) {$http_lang="fr_FR";} |
13 |
-elsif ($http_lang =~ /^hu.*/) {$http_lang="hu_HU";} |
14 |
-elsif ($http_lang =~ /^id.*/) {$http_lang="id_ID";} |
15 |
-elsif ($http_lang =~ /^it.*/) {$http_lang="it_IT";} |
16 |
-elsif ($http_lang =~ /^ja.*/) {$http_lang="ja_JP";} |
17 |
-elsif ($http_lang =~ /^nb.*/) {$http_lang="nb_NO";} |
18 |
-elsif ($http_lang =~ /^nl.*/) {$http_lang="nl_NL";} |
19 |
-elsif ($http_lang =~ /^pt-br.*/) {$http_lang="pt_BR";} |
20 |
-elsif ($http_lang =~ /^pt.*/) {$http_lang="pt_PT";} |
21 |
-elsif ($http_lang =~ /^ru.*/) {$http_lang="ru_RU";} |
22 |
-elsif ($http_lang =~ /^sl.*/) {$http_lang="sl_SI";} |
23 |
-elsif ($http_lang =~ /^sv.*/) {$http_lang="sv_SE";} |
24 |
-elsif ($http_lang =~ /^tr.*/) {$http_lang="tr_TR";} |
25 |
-elsif ($http_lang =~ /^zh-cn.*/) {$http_lang="zh_CN";} |
26 |
-else {$http_lang="en_US";} |
27 |
|
28 |
+$http_lang =~ s/([a-z]{2})-([a-z]{2})/"$1_".uc($2)/e; |
29 |
|
30 |
$ENV{LC_MESSAGES} = "$http_lang"; |
31 |
-setlocale(LC_MESSAGES, ""); |
32 |
+unless(setlocale(LC_MESSAGES, "")){ |
33 |
+ $http_lang = 'en_US'; |
34 |
+ $ENV{LC_MESSAGES} = "$http_lang"; |
35 |
+ setlocale(LC_MESSAGES, ""); |
36 |
+} |
37 |
+ |
38 |
bindtextdomain("sme7admin","/usr/share/locale"); |
39 |
textdomain("sme7admin"); |
40 |
|