/**
  * Constructor
  * @param $request PKPRequest
  */
 function NlmCitationSchemaCitationOutputFormatFilter(&$request)
 {
     parent::Filter();
     // Load additional translations
     $locale = Locale::getLocale();
     $basePath = $this->getBasePath();
     $localeFile = $basePath . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'locale.xml';
     Locale::registerLocaleFile($locale, $localeFile);
     // Save the request for later use
     $this->_request =& $request;
 }
Ejemplo n.º 2
0
 function addCustomLocale($hookName, $args)
 {
     $locale =& $args[0];
     $localeFilename =& $args[1];
     $journal = Request::getJournal();
     $journalId = $journal->getId();
     $publicFilesDir = Config::getVar('files', 'public_files_dir');
     $customLocalePath = $publicFilesDir . DIRECTORY_SEPARATOR . 'journals' . DIRECTORY_SEPARATOR . $journalId . DIRECTORY_SEPARATOR . CUSTOM_LOCALE_DIR . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . $localeFilename;
     import('file.FileManager');
     if (FileManager::fileExists($customLocalePath)) {
         Locale::registerLocaleFile($locale, $customLocalePath, true);
     }
     return true;
 }
Ejemplo n.º 3
0
 function register($category, $path)
 {
     if (parent::register($category, $path)) {
         if ($this->getEnabled()) {
             import('lib.pkp.classes.file.FileManager');
             $press = Request::getPress();
             $pressId = $press->getId();
             $locale = Locale::getLocale();
             $localeFiles = Locale::getLocaleFiles($locale);
             $publicFilesDir = Config::getVar('files', 'public_files_dir');
             $customLocaleDir = $publicFilesDir . DIRECTORY_SEPARATOR . 'presses' . DIRECTORY_SEPARATOR . $pressId . DIRECTORY_SEPARATOR . CUSTOM_LOCALE_DIR;
             foreach ($localeFiles as $localeFile) {
                 $localeFilename = $localeFile->getFilename();
                 $customLocalePath = $customLocaleDir . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . $localeFilename;
                 if (FileManager::fileExists($customLocalePath)) {
                     Locale::registerLocaleFile($locale, $customLocalePath, true);
                 }
             }
         }
         return true;
     }
     return false;
 }
Ejemplo n.º 4
0
 /**
  * Load locale data for this plugin.
  * @param $locale string
  * @return boolean
  */
 function addLocaleData($locale = null)
 {
     if ($locale == '') {
         $locale = Locale::getLocale();
     }
     $localeFilename = $this->getLocaleFilename($locale);
     if ($localeFilename) {
         Locale::registerLocaleFile($locale, $this->getLocaleFilename($locale));
         return true;
     }
     return false;
 }
Ejemplo n.º 5
0
 /**
  * Initialize the locale system.
  */
 function initialize()
 {
     // Use defaults if locale info unspecified.
     $locale = Locale::getLocale();
     $localeFile = Locale::getMainLocaleFilename($locale);
     $sysLocale = $locale . '.' . LOCALE_ENCODING;
     if (!@setlocale(LC_ALL, $sysLocale, $locale)) {
         // For PHP < 4.3.0
         if (setlocale(LC_ALL, $sysLocale) != $sysLocale) {
             setlocale(LC_ALL, $locale);
         }
     }
     Locale::registerLocaleFile($locale, $localeFile);
 }
Ejemplo n.º 6
0
 function requireComponents($components, $locale = null)
 {
     $loadedComponents =& Registry::get('loadedLocaleComponents', true, array());
     if ($locale === null) {
         $locale = Locale::getLocale();
     }
     $filenameComponentMap = Locale::getFilenameComponentMap($locale);
     foreach ($components as $component) {
         // Don't load components twice
         if (isset($loadedComponents[$locale][$component])) {
             continue;
         }
         if (!isset($filenameComponentMap[$component])) {
             fatalError('Unknown locale component ' . $component);
         }
         $filename = $filenameComponentMap[$component];
         Locale::registerLocaleFile($locale, $filename);
         $loadedComponents[$locale][$component] = true;
     }
 }
Ejemplo n.º 7
0
 /**
  * Load locale data for this plugin.
  *
  * @param $locale string
  * @return boolean
  */
 function addLocaleData($locale = null)
 {
     if ($locale == '') {
         $locale = Locale::getLocale();
     }
     $localeFilenames = $this->getLocaleFilename($locale);
     if ($localeFilenames) {
         if (is_scalar($localeFilenames)) {
             $localeFilenames = array($localeFilenames);
         }
         foreach ($localeFilenames as $localeFilename) {
             Locale::registerLocaleFile($locale, $localeFilename);
         }
         return true;
     }
     return false;
 }