From ee215547ffb4af3316a536f8d1c7eae0a0eeee96 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Tue, 22 May 2012 20:38:15 +0000 Subject: only use the primary language subtag of html[lang] --- lib.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib.php b/lib.php index b044849..c86b422 100644 --- a/lib.php +++ b/lib.php @@ -54,6 +54,8 @@ class l10n */ function _mgnav_html($wrap = false, $lang = 'en', $inject = null, $vhost = '//www.mageia.org') { + $lang = _lang_simple($lang); + l10n::load($lang); $tn = array( @@ -102,3 +104,15 @@ function _mgnav_style() { return ''; } + +/** + * Get the primary language subtag only.

+*/ +function _lang_simple($s = null) +{ + if (!is_null($s)) { + $s = explode('-', $s); + $s = strtolower($s[0]); + } + return $s; +} -- cgit v1.2.1