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) + ' (' + cc + ')';
54 Roo.each(Pman.I18n.Data[lang][type], function(d) {
57 return false; // stop!
65 * zh_HK,en to [ { code=zh_HK, title=Chinese }, .... ]
66 * @arg type type (c = country, l = lang)
67 * @arg codes list of languages
69 listToObjects: function (type, codes)
76 var cl = codes.split(',');
77 Roo.each(cl , function(c) {
80 title : _this.toName(type,c)
88 reader : { // std. reader for i18n items.
90 totalProperty : 'total',
101 * these should use generally..
105 reader : Pman.I18n.reader,
107 xtype : 'MemoryProxy',
109 data : Pman.I18n.dataToProxy('l'), // eg. language
111 sortInfo : { field : 'title' , direction : 'ASC' }
120 countryStore : function() { return {
126 url: baseURL + '/I18N/Country.html',
130 reader: Pman.I18n.reader,
133 loadexception : Pman.loadException
138 field: 'title', direction: 'ASC'
143 languageStore: function() {return{
148 url: baseURL + '/I18N/Lang.html',
152 reader: Pman.I18n.reader,
155 loadexception : Pman.loadException
160 field: 'title', direction: 'ASC'
164 currencyStore: function() {return{
169 url: baseURL + '/I18N/Currency.html',
173 reader: Pman.I18n.reader,
176 loadexception : Pman.loadException
181 field: 'title', direction: 'ASC'
185 country: function(cfg) {
189 // things that might need chnaging
190 name : 'country_title',
191 hiddenName : 'country',
194 fieldLabel : "Country",
198 qtip : "Select Country",
203 store: this.countryStore(),
204 displayField:'title',
209 triggerAction: 'all',
210 //emptyText:'Select a state...',
216 language: function(cfg) {
220 // things that might need chnaging
222 name : 'language_title',
223 hiddenName : 'language',
226 fieldLabel : "Language",
230 qtip : "Select Language",
235 store: this.languageStore(),
236 displayField:'title',
242 triggerAction: 'all',
243 //emptyText:'Select a state...',
249 currency: function(cfg) {
253 // things that might need chnaging
254 name : 'currency_title',
255 hiddenName : 'currency',
258 fieldLabel : "Currency",
262 qtip : "Select Currency",
267 store: this.currencyStore(),
273 triggerAction: 'all',
274 //emptyText:'Select a state...',
276 tpl: new Ext.Template(
277 '<div class="x-grid-cell-text x-btn button">',
278 '{title} ({code})</b>',
285 languageList : function(cfg) {
292 fieldLabel : "Language(s)",
295 renderer : function(d) {
296 return String.format('{0}', d.title );
300 xtype: 'ComboBoxLister',
301 displayField:'title',
304 qtip : "Select a language to add.",
310 store: this.languageStore(),
314 forceSelection: true,
316 triggerAction: 'all',
317 tpl: new Ext.Template(
318 '<div class="x-grid-cell-text x-btn button">',
322 queryParam: 'query[name]',
323 loadingText: "Searching...",
328 setList : function(ar) {
330 Roo.each(ar, function(a) {
334 toList : function() {
336 this.items.each(function(a) {
346 countryList : function(cfg) {
353 fieldLabel : "Country(s)",
356 renderer : function(d) {
357 return String.format('{0}', d.title );
361 xtype: 'ComboBoxLister',
362 displayField:'title',
365 qtip : "Select a country to add.",
371 store: this.countryStore(),
375 forceSelection: true,
377 triggerAction: 'all',
378 tpl: new Ext.Template(
379 '<div class="x-grid-cell-text x-btn button">',
383 queryParam: 'query[name]',
384 loadingText: "Searching...",
389 setList : function(ar) {
391 Roo.each(ar, function(a) {
395 toList : function() {
397 this.items.each(function(a) {