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',
103 * these should use generally..
107 reader : Pman.I18n.reader,
109 xtype : 'MemoryProxy',
111 data : Pman.I18n.dataToProxy('l'), // eg. language
113 sortInfo : { field : 'title' , direction : 'ASC' }
121 dataToProxy : function(type)
123 var lang = Pman.Login.authUser.lang || 'en';
124 return Pman.I18n.Data[lang][type];
129 countryStore : function() { return {
135 url: baseURL + '/I18N/Country.html',
139 reader: Pman.I18n.reader,
142 loadexception : Pman.loadException
147 field: 'title', direction: 'ASC'
152 languageStore: function() {return{
157 url: baseURL + '/I18N/Lang.html',
161 reader: Pman.I18n.reader,
164 loadexception : Pman.loadException
169 field: 'title', direction: 'ASC'
173 currencyStore: function() {return{
178 url: baseURL + '/I18N/Currency.html',
182 reader: Pman.I18n.reader,
185 loadexception : Pman.loadException
190 field: 'title', direction: 'ASC'
194 country: function(cfg) {
198 // things that might need chnaging
199 name : 'country_title',
200 hiddenName : 'country',
203 fieldLabel : "Country",
207 qtip : "Select Country",
212 store: this.countryStore(),
213 displayField:'title',
218 triggerAction: 'all',
219 //emptyText:'Select a state...',
225 language: function(cfg) {
229 // things that might need chnaging
231 name : 'language_title',
232 hiddenName : 'language',
235 fieldLabel : "Language",
239 qtip : "Select Language",
244 store: this.languageStore(),
245 displayField:'title',
251 triggerAction: 'all',
252 //emptyText:'Select a state...',
258 currency: function(cfg) {
262 // things that might need chnaging
263 name : 'currency_title',
264 hiddenName : 'currency',
267 fieldLabel : "Currency",
271 qtip : "Select Currency",
276 store: this.currencyStore(),
282 triggerAction: 'all',
283 //emptyText:'Select a state...',
285 tpl: new Ext.Template(
286 '<div class="x-grid-cell-text x-btn button">',
287 '{title} ({code})</b>',
294 languageList : function(cfg) {
301 fieldLabel : "Language(s)",
304 renderer : function(d) {
305 return String.format('{0}', d.title );
309 xtype: 'ComboBoxLister',
310 displayField:'title',
313 qtip : "Select a language to add.",
319 store: this.languageStore(),
323 forceSelection: true,
325 triggerAction: 'all',
326 tpl: new Ext.Template(
327 '<div class="x-grid-cell-text x-btn button">',
331 queryParam: 'query[name]',
332 loadingText: "Searching...",
337 setList : function(ar) {
339 Roo.each(ar, function(a) {
343 toList : function() {
345 this.items.each(function(a) {
355 countryList : function(cfg) {
362 fieldLabel : "Country(s)",
365 renderer : function(d) {
366 return String.format('{0}', d.title );
370 xtype: 'ComboBoxLister',
371 displayField:'title',
374 qtip : "Select a country to add.",
380 store: this.countryStore(),
384 forceSelection: true,
386 triggerAction: 'all',
387 tpl: new Ext.Template(
388 '<div class="x-grid-cell-text x-btn button">',
392 queryParam: 'query[name]',
393 loadingText: "Searching...",
398 setList : function(ar) {
400 Roo.each(ar, function(a) {
404 toList : function() {
406 this.items.each(function(a) {