/[web]/nav/lib.php
ViewVC logotype

Diff of /nav/lib.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1154 by rda, Tue May 22 20:38:15 2012 UTC revision 1254 by rda, Sun May 27 17:43:47 2012 UTC
# Line 54  class l10n Line 54  class l10n
54  */  */
55  function _mgnav_html($wrap = false, $lang = 'en', $inject = null, $vhost = '//www.mageia.org')  function _mgnav_html($wrap = false, $lang = 'en', $inject = null, $vhost = '//www.mageia.org')
56  {  {
57      $lang = _lang_simple($lang);      $lang = _lang_check($lang);
58    
59      l10n::load($lang);      l10n::load($lang);
60    
# Line 108  function _mgnav_style() Line 108  function _mgnav_style()
108  /**  /**
109   * Get the primary language subtag only.<p></p>   * Get the primary language subtag only.<p></p>
110  */  */
111  function _lang_simple($s = null)  function _lang_check($s = null)
112  {  {
113      if (!is_null($s)) {      if (!is_null($s)) {
114          $s = explode('-', $s);          $sub = explode('-', $s);
115          $s = strtolower($s[0]);          $sub = strtolower($sub[0]);
116      }      }
117      return $s;  
118        $supported = array(
119            'cs',
120            'de',
121            'el', 'en', 'eo', 'es', 'et',
122            'fi', 'fr',
123            'it',
124            'lv',
125            'nb', 'nl',
126            'pl', 'pt', 'pt-br',
127            'ro', 'ru',
128            'sl',
129            'tr',
130            'uk',
131            'zh-cn', 'zh-tw'
132        );
133    
134        if (in_array($s, $supported))
135            return $s;
136    
137        if (in_array($sub, $supported))
138            return $s;
139    
140        return 'en';
141  }  }

Legend:
Removed from v.1154  
changed lines
  Added in v.1254

  ViewVC Help
Powered by ViewVC 1.1.30