diff options
author | Romain d'Alverny <rda@mageia.org> | 2012-05-27 17:43:47 +0000 |
---|---|---|
committer | Romain d'Alverny <rda@mageia.org> | 2012-05-27 17:43:47 +0000 |
commit | f69e8c59454cca94b53b1a3f094c923b44992b17 (patch) | |
tree | 704602b8b8dcbf3e0122c3b25c768499c5c468f9 /lib.php | |
parent | f988d9a0caadca36e723a37498d3b537439ef8c0 (diff) | |
download | nav-f69e8c59454cca94b53b1a3f094c923b44992b17.tar nav-f69e8c59454cca94b53b1a3f094c923b44992b17.tar.gz nav-f69e8c59454cca94b53b1a3f094c923b44992b17.tar.bz2 nav-f69e8c59454cca94b53b1a3f094c923b44992b17.tar.xz nav-f69e8c59454cca94b53b1a3f094c923b44992b17.zip |
pt-br (Luis)
Diffstat (limited to 'lib.php')
-rw-r--r-- | lib.php | 33 |
1 files changed, 28 insertions, 5 deletions
@@ -54,7 +54,7 @@ class l10n */ function _mgnav_html($wrap = false, $lang = 'en', $inject = null, $vhost = '//www.mageia.org') { - $lang = _lang_simple($lang); + $lang = _lang_check($lang); l10n::load($lang); @@ -108,11 +108,34 @@ function _mgnav_style() /** * Get the primary language subtag only.<p></p> */ -function _lang_simple($s = null) +function _lang_check($s = null) { if (!is_null($s)) { - $s = explode('-', $s); - $s = strtolower($s[0]); + $sub = explode('-', $s); + $sub = strtolower($sub[0]); } - return $s; + + $supported = array( + 'cs', + 'de', + 'el', 'en', 'eo', 'es', 'et', + 'fi', 'fr', + 'it', + 'lv', + 'nb', 'nl', + 'pl', 'pt', 'pt-br', + 'ro', 'ru', + 'sl', + 'tr', + 'uk', + 'zh-cn', 'zh-tw' + ); + + if (in_array($s, $supported)) + return $s; + + if (in_array($sub, $supported)) + return $s; + + return 'en'; } |