linea21-utils
[ class tree: linea21-utils ] [ index: linea21-utils ] [ all elements ]

Source for file lang.php

Documentation is available at lang.php

  1. <?php
  2. /**
  3.  * @package linea21.utils
  4.  * @subpackage lib
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11. /**
  12. * getLang()
  13. * offers the ability to force lang into url then session
  14. * (used for demo)
  15. @return void 
  16. */
  17. function getLang({
  18.   if(isset($_GET['flang']))
  19.   {
  20.     in_array($_GET['flang']availableLanguages()) $_SESSION['flang'$_GET['flang'die('no way!');
  21.     return $_GET['flang'];
  22.   }
  23.   if(isset($_SESSION['flang'])) {
  24.     in_array($_SESSION['flang']availableLanguages()) die('no way!');
  25.     return $_SESSION['flang'];
  26.   }
  27.   return LANGUAGE;
  28. }
  29. /**
  30. * IncludeLang()
  31. * Fait les includes de fichiers de langue en fonction de la rubrique active ( partie publique )
  32. @return void (include)
  33. */
  34. function IncludeLang()
  35. {
  36.     $language getLang();
  37.     include_once('../languages/' $language '/lang_common.' CHARSET '.php');
  38.  
  39.     if (ActiveItemAlias($GLOBALS['activeitem']== 'directory'{
  40.         include_once('../languages/' $language '/lang_yellowpages.' CHARSET '.php');
  41.     }
  42.     if (ActiveItemAlias($GLOBALS['activeitem']== 'dashboard'{
  43.         include_once('../languages/' $language '/lang_sdi.' CHARSET '.php');
  44.         include_once('../languages/' $language '/lang_dashboard.' CHARSET '.php');
  45.     }
  46.     if (ActiveItemAlias($GLOBALS['activeitem']== 'workgroup'{
  47.         include_once('../languages/' $language '/lang_workshop.' CHARSET '.php');
  48.         include_once('../languages/' $language '/lang_workshoprep.' CHARSET '.php');
  49.         include_once('../languages/' $language '/lang_publication.' CHARSET '.php');
  50.     }
  51.     if (ActiveItemAlias($GLOBALS['activeitem']== 'project'{
  52.         include_once('../languages/' $language '/lang_project.' CHARSET '.php');
  53.     }
  54.     if (ActiveItemAlias($GLOBALS['activeitem']== 'publication'{
  55.         include_once('../languages/' $language '/lang_publication.' CHARSET '.php');
  56.     }
  57.     if (ActiveItemAlias($GLOBALS['activeitem']== 'user-prefs'{
  58.         include_once('../languages/' $language '/lang_user.' CHARSET '.php');
  59.     }
  60.     if (ActiveItemAlias($GLOBALS['activeitem']== 'news'{
  61.         include_once('../languages/' $language '/lang_news.' CHARSET '.php');
  62.     }
  63.     if (ActiveItemAlias($GLOBALS['activeitem']== 'subscribe-newsletter'{
  64.         include_once('../languages/' $language '/lang_newsletter.' CHARSET '.php');
  65.     }
  66.     if (ActiveItemAlias($GLOBALS['activeitem']== 'search'{
  67.         include_once('../languages/' $language '/lang_search.' CHARSET '.php');
  68.     }
  69.  
  70.     $GLOBALS['lang'$lang;
  71.  
  72. /**
  73. * IncludeAdminLang()
  74. * Fait les includes de fichiers de langue en fonction de la rubrique active ( partie admin )
  75. @return void (include)
  76. */
  77. function IncludeAdminLang($rubrique)
  78. {
  79.     $language getLang();
  80.     include_once('../languages/' $language '/lang_common.' CHARSET '.php');
  81.     include_once('../languages/' $language '/lang_' $rubrique '.' CHARSET '.php');
  82.  
  83.     if ($rubrique === 'dashboard'{
  84.         include_once('../languages/' $language '/lang_sdi.' CHARSET '.php');
  85.     
  86.     if ($rubrique === 'sdi'{
  87.         include_once('../languages/' $language '/lang_dashboard.' CHARSET '.php');
  88.     
  89.  
  90.     $GLOBALS['lang'$lang;
  91.  
  92. /**
  93.  * _t()
  94.  * Translate item
  95.  * @param string $item 
  96.  * @return string 
  97.  ***/
  98. function _t($scope$item)
  99.   if(isset($GLOBALS['lang'][$scope][$item])) return $GLOBALS['lang'][$scope][$item];
  100.   else return $scope." ".$item;
  101. }
  102. ?>

Documentation generated on Fri, 16 Oct 2009 09:34:28 +0200 by phpDocumentor 1.4.1