1 //<script type="text/javascript">
5 * A few usefull tools to convert language info...
7 * Our login details contain the available translation data..
10 * Languages are included in the main application
11 * using <script src="baseURL/Core/I18N/Data.js"></script>
12 * which set's up. Pman.I18n.data
16 * includes standard pulldowns.
22 * turn zh_HK,en => into Chinese(HK) , English
23 * @arg type type (c = country, l = lang)
24 * @arg codes list of languages
26 listToNames: function (type, codes)
30 var cl = codes.split(',');
31 Roo.each(cl , function(c) {
32 ret.push(_this.toName(type, c));
34 return ret.join(', ');
38 * turns zh_HK into a Chinese(HK)
39 * @arg type type (c = country, l = lang)
40 * @arg langcode language code (eg. zh_HK, UK etc.)
43 toName: function(type, code)
46 var lang = Pman.Login.authUser.lang || 'en'
47 if (code.indexOf('_') > -1) {
48 var clang = code.split('_').shift();
49 var cc = code.split('_').pop();
50 return this.toName('l', clang) + ' (' + this.toName('c', cc) + ')';
54 Roo.each(Pman.I18n.Data[lang], function(d) {
64 * zh_HK,en to [ { code=zh_HK, title=Chinese }, .... ]
65 * @arg type type (c = country, l = lang)
66 * @arg codes list of languages
68 listToObjects: function (type, codes)
75 var cl = codes.split(',');
76 Roo.each(cl , function(c) {
79 title : _this.toName(type,c)
87 reader : { // std. reader for i18n items.
89 totalProperty : 'total',
98 countryStore : function() { return {
104 url: baseURL + '/I18N/Country.html',
108 reader: Pman.I18n.reader,
111 loadexception : Pman.loadException
116 field: 'title', direction: 'ASC'
121 languageStore: function() {return{
126 url: baseURL + '/I18N/Lang.html',
130 reader: Pman.I18n.reader,
133 loadexception : Pman.loadException
138 field: 'title', direction: 'ASC'
142 currencyStore: function() {return{
147 url: baseURL + '/I18N/Currency.html',
151 reader: Pman.I18n.reader,
154 loadexception : Pman.loadException
159 field: 'title', direction: 'ASC'
163 country: function(cfg) {
167 // things that might need chnaging
168 name : 'country_title',
169 hiddenName : 'country',
172 fieldLabel : "Country",
176 qtip : "Select Country",
181 store: this.countryStore(),
182 displayField:'title',
187 triggerAction: 'all',
188 //emptyText:'Select a state...',
194 language: function(cfg) {
198 // things that might need chnaging
200 name : 'language_title',
201 hiddenName : 'language',
204 fieldLabel : "Language",
208 qtip : "Select Language",
213 store: this.languageStore(),
214 displayField:'title',
220 triggerAction: 'all',
221 //emptyText:'Select a state...',
227 currency: function(cfg) {
231 // things that might need chnaging
232 name : 'currency_title',
233 hiddenName : 'currency',
236 fieldLabel : "Currency",
240 qtip : "Select Currency",
245 store: this.currencyStore(),
251 triggerAction: 'all',
252 //emptyText:'Select a state...',
254 tpl: new Ext.Template(
255 '<div class="x-grid-cell-text x-btn button">',
256 '{title} ({code})</b>',
263 languageList : function(cfg) {
270 fieldLabel : "Language(s)",
273 renderer : function(d) {
274 return String.format('{0}', d.title );
278 xtype: 'ComboBoxLister',
279 displayField:'title',
282 qtip : "Select a language to add.",
288 store: this.languageStore(),
292 forceSelection: true,
294 triggerAction: 'all',
295 tpl: new Ext.Template(
296 '<div class="x-grid-cell-text x-btn button">',
300 queryParam: 'query[name]',
301 loadingText: "Searching...",
306 setList : function(ar) {
308 Roo.each(ar, function(a) {
312 toList : function() {
314 this.items.each(function(a) {
324 countryList : function(cfg) {
331 fieldLabel : "Country(s)",
334 renderer : function(d) {
335 return String.format('{0}', d.title );
339 xtype: 'ComboBoxLister',
340 displayField:'title',
343 qtip : "Select a country to add.",
349 store: this.countryStore(),
353 forceSelection: true,
355 triggerAction: 'all',
356 tpl: new Ext.Template(
357 '<div class="x-grid-cell-text x-btn button">',
361 queryParam: 'query[name]',
362 loadingText: "Searching...",
367 setList : function(ar) {
369 Roo.each(ar, function(a) {
373 toList : function() {
375 this.items.each(function(a) {