本文整理汇总了PHP中eZLocale::localeRegexp方法的典型用法代码示例。如果您正苦于以下问题:PHP eZLocale::localeRegexp方法的具体用法?PHP eZLocale::localeRegexp怎么用?PHP eZLocale::localeRegexp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZLocale
的用法示例。
在下文中一共展示了eZLocale::localeRegexp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: languageList
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;
}
示例2: array
$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 {