diff options
-rw-r--r-- | langs/pt-br.lang | 14 | ||||
-rw-r--r-- | lib.php | 33 |
2 files changed, 42 insertions, 5 deletions
diff --git a/langs/pt-br.lang b/langs/pt-br.lang new file mode 100644 index 0000000..85e8e6e --- /dev/null +++ b/langs/pt-br.lang @@ -0,0 +1,14 @@ +;About us +Sobre + +;Downloads +Downloads + +;Support +Suporte + +;Community +Comunidade + +;Contribute +Contribuir @@ -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'; } |