Example #1
0
 public function __construct($language, $langstr = null)
 {
     if ($langstr == null) {
         $langstr = array();
     }
     $this->_name = $language;
     $systemLocale = $this->getIsoName();
     $options = array($systemLocale . ".UTF8", $systemLocale . ".UTF-8", $systemLocale . ".utf8", $systemLocale . ".utf-8", $systemLocale, $language, $this->_name);
     $this->_cultureActive = setlocale(LC_ALL, $options);
     // Try to load in Windows if failed before
     if (!$this->_cultureActive) {
         $row = LocaleFactory::getInfoLocaleDB('shortname', $this->getName());
         $langstr = $row->getFieldArray("langstr");
         $iLang = 0;
         while (!$this->_cultureActive && $iLang < count($langstr)) {
             $this->_cultureActive = setlocale(LC_ALL, $langstr[$iLang]);
             $iLang++;
         }
     }
     if (!$this->_cultureActive) {
         $firstPart = substr($language, 0, 2);
         if (FileUtil::isWindowsOS()) {
             $complement = "";
         } else {
             $complement = "Only the languages available in 'locale -a' can be setted. On debian try execute 'apt-get install language-pack-{$firstPart}'.";
         }
         echo "<br/>\n<b>Warning: </b> The culture language '{$language}' was not found. {$complement}\n<br/>";
         // I cant call the context here because it's call CultureInfo but the context is not complete yet.
         //$context = Context::getInstance();
         //$context->WriteWarningMessage ("");
     }
     $this->_localeConv = localeConv();
     #if (stripos(PHP_OS, 'win') !== false)
     #{
     #	$this->_localeConv["currency_symbol"] = utf8_encode($this->_localeConv["currency_symbol"]);
     #}
     #Debug::PrintValue($this->_localeConv, $langstr, $this->getRegionalMonthNames());
 }