本文整理汇总了PHP中AppLocale::getLocaleFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP AppLocale::getLocaleFiles方法的具体用法?PHP AppLocale::getLocaleFiles怎么用?PHP AppLocale::getLocaleFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppLocale
的用法示例。
在下文中一共展示了AppLocale::getLocaleFiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
function register($category, $path)
{
if (parent::register($category, $path)) {
if ($this->getEnabled()) {
// Add custom locale data for already registered locale files.
$locale = AppLocale::getLocale();
$localeFiles = AppLocale::getLocaleFiles($locale);
$journal = Request::getJournal();
$journalId = $journal->getId();
$publicFilesDir = Config::getVar('files', 'public_files_dir');
$customLocalePathBase = $publicFilesDir . DIRECTORY_SEPARATOR . 'journals' . DIRECTORY_SEPARATOR . $journalId . DIRECTORY_SEPARATOR . CUSTOM_LOCALE_DIR . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR;
import('lib.pkp.classes.file.FileManager');
$fileManager = new FileManager();
foreach ($localeFiles as $localeFile) {
$customLocalePath = $customLocalePathBase . $localeFile->getFilename();
if ($fileManager->fileExists($customLocalePath)) {
AppLocale::registerLocaleFile($locale, $customLocalePath, true);
}
}
// Add custom locale data for all locale files registered after this plugin
HookRegistry::register('PKPLocale::registerLocaleFile', array(&$this, 'addCustomLocale'));
}
return true;
}
return false;
}
示例2: LocaleFile
/**
* Register a locale file against the current list.
* @param $locale string Locale key
* @param $filename string Filename to new locale XML file
* @param $addToTop boolean Whether to add to the top of the list (true)
* or the bottom (false). Allows overriding.
*/
function ®isterLocaleFile($locale, $filename, $addToTop = false)
{
$localeFiles =& AppLocale::getLocaleFiles($locale);
$localeFile = new LocaleFile($locale, $filename);
if (!$localeFile->isValid()) {
$localeFile = null;
return $localeFile;
}
if ($addToTop) {
// Work-around: unshift by reference.
array_unshift($localeFiles, '');
$localeFiles[0] =& $localeFile;
} else {
$localeFiles[] =& $localeFile;
}
HookRegistry::call('PKPLocale::registerLocaleFile', array(&$locale, &$filename, &$addToTop));
return $localeFile;
}