Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
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) {
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 
108  static function setSupportedLocales($supportedLocales) {
109  self::$supportedLocales = $supportedLocales;
110  }
111 
116  static function getSupportedLocales() {
117  return self::$supportedLocales;
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 ?>
Mock implementation of the Locale class.
static getLocalePrecedence()
static requireComponents()
static getPrimaryLocale()
static getSupportedLocales()
static setTranslations($translations)
Provides methods for loading locale data and translating strings identified by unique keys...
static setSupportedLocales($supportedLocales)
static getLocale()
static setPrimaryLocale($primaryLocale)
static translate($key, $params=array(), $locale=null)
static getSupportedFormLocales()