Esempio n. 1
0
 function createLanguage($iso639, $iso3166, $iso3166_3)
 {
     $locales = mamboLanguage::getLocales();
     $default = $locales['locales'][$iso639];
     $lang = $iso639;
     $lang .= strlen($iso3166) == 2 ? '_' . $iso3166 : '';
     $language =& new mamboLanguage($lang);
     foreach ($default as $k => $v) {
         if (in_array($k, array_keys(get_class_vars(get_class($language))))) {
             $language->{$k} = $v;
         }
     }
     foreach ($_POST as $k => $v) {
         if (in_array($k, array_keys(get_class_vars(get_class($language))))) {
             $language->{$k} = $v;
         }
     }
     $language->name = $lang;
     $language->description = $language->title . ' Locale';
     if (!empty($language->territory)) {
         $language->description .= ' For ' . $language->territory;
     }
     $language->locale = $lang . '.' . $language->charset . ',' . $lang . ',' . $iso639 . ',' . strtolower($language->title);
     $language->iso3166_3 = $iso3166_3;
     $language->creationdate = date('d-m-Y');
     $language->author = 'Mambo Foundation Inc.';
     $language->authorurl = 'http://www.mambo-foundation.org';
     $language->authoremail = '*****@*****.**';
     $language->copyright = 'Refer to copyright.php';
     $language->license = 'http://www.gnu.org/copyleft/gpl.html GNU/GPL';
     $language->setPlurals($_POST['plural_form']);
     $textdomain = rtrim($language->path, '\\/');
     $dir = $textdomain . '/' . $language->name;
     $untranslated = $textdomain . '/untranslated';
     $charset = $language->charset;
     $langfiles = mosReadDirectory($untranslated, '.pot$');
     @mkdir($dir);
     @mkdir($dir . '/LC_MESSAGES');
     //$gettext_admin = new PHPGettextAdmin();
     foreach ($langfiles as $domain) {
         $domain = substr($domain, 0, -4);
         /*if (file_exists("$textdomain/glossary/$lang.$charset.po")) {
               copy("$textdomain/glossary/$lang.$charset.po", "$dir/$lang.po");
               $gettext_admin->initialize_translation($domain, $textdomain, $lang, $charset);
               $gettext_admin->compile($lang, $textdomain, $charset);
           } else {*/
         copy("{$untranslated}/{$domain}.pot", "{$dir}/{$domain}.po");
         //}
     }
     //if (!file_exists("$textdomain/$lang/$lang.po")) {
     //    @copy("$textdomain/glossary/untranslated.pot", "$textdomain/$lang/$lang.po");
     //}
     $language->save();
 }
Esempio n. 2
0
function getlocales()
{
    return mamboLanguage::getLocales();
}