static function languageList($withVariations = true) { $languages =& $GLOBALS['eZLocaleLanguageist']; if (!is_array($languages)) { $localeRegexp = eZLocale::localeRegexp($withVariations, false); $languages = array(); $dir = opendir('share/locale'); while (($file = readdir($dir)) !== false) { if (preg_match("/^{$localeRegexp}\\.ini\$/", $file, $regs)) { $languages[] = $regs[1]; } } closedir($dir); $languages = array_unique($languages); sort($languages); } return $languages; }
$translationName = ''; $translationLocale = ''; eZDebug::writeDebug($localeID, 'localeID'); if ($localeID != '' and $localeID != -1) { $translationLocale = $localeID; $localeInstance = eZLocale::instance($translationLocale); $translationName = $localeInstance->internationalLanguageName(); } else { $translationName = $Module->actionParameter('TranslationName'); $translationLocale = $Module->actionParameter('TranslationLocale'); eZDebug::writeDebug($translationName, 'translationName'); eZDebug::writeDebug($translationLocale, 'translationLocale'); } // Make sure the locale string is valid, if not we try to extract a valid part of it if (!preg_match("/^" . eZLocale::localeRegexp(false, false) . "\$/", $translationLocale)) { if (preg_match("/(" . eZLocale::localeRegexp(false, false) . ")/", $translationLocale, $matches)) { $translationLocale = $matches[1]; } else { // The locale cannot be used so we show the edit page again. $tpl->setVariable('is_edit', $Module->isCurrentAction('Edit')); $Result['content'] = $tpl->fetch('design:content/translationnew.tpl'); $Result['path'] = array(array('text' => ezpI18n::tr('kernel/content', 'Translation'), 'url' => false), array('text' => 'New', 'url' => false)); return; } } if (!eZContentLanguage::fetchByLocale($translationLocale)) { $locale = eZLocale::instance($translationLocale); if ($locale->isValid()) { $translation = eZContentLanguage::addLanguage($locale->localeCode(), $translationName); ezpEvent::getInstance()->notify('content/translations/cache', array($translation->attribute('id'))); } else {