Changeset 135
- Timestamp:
- 02/28/07 17:58:23 (3 years ago)
- Files:
-
- 1 modified
-
trunk/code/I18n.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/code/I18n.js
r110 r135 47 47 48 48 /** 49 * The default method for retrieving the locale. 50 * @ignore 51 */ 52 var localeGetter = function() { 53 return java.util.Locale.getDefault(); 54 }; 55 56 /** 49 57 * Overwrite the default object containing 50 58 * the messages (ie. a vanilla EcmaScript object). … … 62 70 this.getMessages = function() { 63 71 return messages; 72 }; 73 74 /** 75 * Set the method for retrieving the locale. 76 * @param {Function} func The getter method 77 */ 78 this.setLocaleGetter = function(func) { 79 if (func && func.constructor == Function) { 80 localeGetter = func; 81 } else { 82 throw Error("Getter method to retrieve locale must be a function"); 83 } 84 return; 85 }; 86 87 /** 88 * Get the method for retrieving the locale. 89 * @returns The getter method 90 * @type Function 91 */ 92 this.getLocaleGetter = function() { 93 return localeGetter; 64 94 }; 65 95 … … 127 157 var translation = null; 128 158 if (singularKey) { 129 // use either the locale defined in res.meta.locale or the jvm default130 var locale = res.meta.locale || java.util.Locale.getDefault();159 // use the getter method for retrieving the locale 160 var locale = this.getLocaleGetter()(); 131 161 var catalog, key; 132 162 if ((catalog = jala.i18n.getCatalog(locale))) { … … 204 234 } 205 235 } 206 // use either the locale defined in res.meta.locale or the jvm default207 var locale = res.meta.locale || java.util.Locale.getDefault();236 // use the getter method for retrieving the locale 237 var locale = this.getLocaleGetter()(); 208 238 // format the message 209 239 try {
![(please configure the [header_logo] section in trac.ini)](/trac/jala/chrome/common/trac_banner.png)