Open Journal Systems  3.3.0
env1/MockAppLocale.inc.php
1 <?php
2 
16 define('LOCALE_REGISTRY_FILE', 'lib/pkp/tests/registry/locales.xml');
17 define('LOCALE_ENCODING', 'utf-8');
18 
19 import('lib.pkp.classes.i18n.PKPLocale');
20 
21 class AppLocale extends PKPLocale {
22  static
23  $primaryLocale = 'en_US',
24  $supportedLocales = array('en_US' => 'English/America'),
25  $translations = array();
26 
27  /*
28  * method required during setup of
29  * the PKP application framework
30  */
31  static function initialize($request) {
32  // do nothing
33  }
34 
35  /*
36  * method required during setup of
37  * the PKP application framework
38  * @return string test locale
39  */
40  static function getLocale() {
41  return 'en_US';
42  }
43 
44  /*
45  * method required during setup of
46  * the PKP application framework
47  */
48  static function registerLocaleFile($locale, $filename, $addToTop = false) {
49  // do nothing
50  }
51 
56  static function requireComponents() {
57  // do nothing
58  }
59 
64  static function getLocalePrecedence() {
65  return array('en_US', 'fr_FR');
66  }
67 
75  static function translate($key, $params = array(), $locale = null, $missingKeyHandler = array()) {
76  if (isset(self::$translations[$key])) {
77  return self::$translations[$key];
78  }
79  return "##$key##";
80  }
81 
87  static function setPrimaryLocale($primaryLocale) {
88  self::$primaryLocale = $primaryLocale;
89  }
90 
95  static function getPrimaryLocale() {
96  return self::$primaryLocale;
97  }
98 
109  self::$supportedLocales = $supportedLocales;
110  }
111 
116  static function getSupportedLocales() {
118  }
119 
124  static function getSupportedFormLocales() {
125  return array('en_US');
126  }
127 
132  static function setTranslations($translations) {
133  self::$translations = $translations;
134  }
135 }
136 
AppLocale\initialize
static initialize($request)
Definition: env1/MockAppLocale.inc.php:31
AppLocale\requireComponents
static requireComponents()
Definition: env1/MockAppLocale.inc.php:56
AppLocale\setSupportedLocales
static setSupportedLocales($supportedLocales)
Definition: env1/MockAppLocale.inc.php:108
AppLocale\$supportedLocales
static $supportedLocales
Definition: env1/MockAppLocale.inc.php:24
PKPLocale\$request
static $request
Definition: PKPLocale.inc.php:74
AppLocale\registerLocaleFile
static registerLocaleFile($locale, $filename, $addToTop=false)
Definition: env1/MockAppLocale.inc.php:48
AppLocale\setTranslations
static setTranslations($translations)
Definition: env1/MockAppLocale.inc.php:132
AppLocale\setPrimaryLocale
static setPrimaryLocale($primaryLocale)
Definition: env1/MockAppLocale.inc.php:87
AppLocale\getPrimaryLocale
static getPrimaryLocale()
Definition: env1/MockAppLocale.inc.php:95
AppLocale\$translations
static $translations
Definition: env1/MockAppLocale.inc.php:25
PKPLocale
Provides methods for loading locale data and translating strings identified by unique keys.
Definition: PKPLocale.inc.php:73
AppLocale\translate
static translate($key, $params=array(), $locale=null, $missingKeyHandler=array())
Definition: env1/MockAppLocale.inc.php:75
AppLocale\$primaryLocale
static $primaryLocale
Definition: env1/MockAppLocale.inc.php:23
AppLocale\getSupportedLocales
static getSupportedLocales()
Definition: env1/MockAppLocale.inc.php:116
AppLocale\getLocale
static getLocale()
Definition: env1/MockAppLocale.inc.php:40
AppLocale\getSupportedFormLocales
static getSupportedFormLocales()
Definition: env1/MockAppLocale.inc.php:124
AppLocale\getLocalePrecedence
static getLocalePrecedence()
Definition: env1/MockAppLocale.inc.php:64
AppLocale
Provides methods for loading locale data and translating strings identified by unique keys.
Definition: AppLocale.inc.php:19