MkFramework
 All Data Structures Functions
plugin_i18n.php
1 <?php
2 /*
3 This file is part of Mkframework.
4 
5 Mkframework is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License.
8 
9 Mkframework is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13 
14 You should have received a copy of the GNU Lesser General Public License
15 along with Mkframework. If not, see <http://www.gnu.org/licenses/>.
16 
17 */
24 
25  private static $tLangue;
26 
32  public static function load($sLang){
33  $tAllowed=preg_split('/,/',_root::getConfigVar('language.allow') );
34  if(!in_array($sLang,$tAllowed) and $sLang!=_root::getConfigVar('language.default') ){
35  throw new Exception('Lang not allowed, list allow:'._root::getConfigVar('language.allow'));
36  }
37  include_once _root::getConfigVar('path.i18n').$sLang.'.php';
38 
39  self::$tLangue=_root::getConfigVar('tLangue');
40  }
41 
47  public static function get($sTag){
48  if( !isset(self::$tLangue[$sTag]) ){
49  return $sTag.'(need translation)';
50  }
51  return self::$tLangue[$sTag];
52  }
53 
54 
55 
56 }
static getConfigVar($sCatAndVar, $uDefaut=null)
Definition: class_root.php:654
static load($sLang)
Definition: plugin_i18n.php:32