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) {
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',
99 countryStore : function() { return {
105 url: baseURL + '/I18N/Country.html',
109 reader: Pman.I18n.reader,
112 loadexception : Pman.loadException
117 field: 'title', direction: 'ASC'
122 languageStore: function() {return{
127 url: baseURL + '/I18N/Lang.html',
131 reader: Pman.I18n.reader,
134 loadexception : Pman.loadException
139 field: 'title', direction: 'ASC'
143 currencyStore: function() {return{
148 url: baseURL + '/I18N/Currency.html',
152 reader: Pman.I18n.reader,
155 loadexception : Pman.loadException
160 field: 'title', direction: 'ASC'
164 country: function(cfg) {
168 // things that might need chnaging
169 name : 'country_title',
170 hiddenName : 'country',
173 fieldLabel : "Country",
177 qtip : "Select Country",
182 store: this.countryStore(),
183 displayField:'title',
188 triggerAction: 'all',
189 //emptyText:'Select a state...',
195 language: function(cfg) {
199 // things that might need chnaging
201 name : 'language_title',
202 hiddenName : 'language',
205 fieldLabel : "Language",
209 qtip : "Select Language",
214 store: this.languageStore(),
215 displayField:'title',
221 triggerAction: 'all',
222 //emptyText:'Select a state...',
228 currency: function(cfg) {
232 // things that might need chnaging
233 name : 'currency_title',
234 hiddenName : 'currency',
237 fieldLabel : "Currency",
241 qtip : "Select Currency",
246 store: this.currencyStore(),
252 triggerAction: 'all',
253 //emptyText:'Select a state...',
255 tpl: new Ext.Template(
256 '<div class="x-grid-cell-text x-btn button">',
257 '{title} ({code})</b>',
264 languageList : function(cfg) {
271 fieldLabel : "Language(s)",
274 renderer : function(d) {
275 return String.format('{0}', d.title );
279 xtype: 'ComboBoxLister',
280 displayField:'title',
283 qtip : "Select a language to add.",
289 store: this.languageStore(),
293 forceSelection: true,
295 triggerAction: 'all',
296 tpl: new Ext.Template(
297 '<div class="x-grid-cell-text x-btn button">',
301 queryParam: 'query[name]',
302 loadingText: "Searching...",
307 setList : function(ar) {
309 Roo.each(ar, function(a) {
313 toList : function() {
315 this.items.each(function(a) {
325 countryList : function(cfg) {
332 fieldLabel : "Country(s)",
335 renderer : function(d) {
336 return String.format('{0}', d.title );
340 xtype: 'ComboBoxLister',
341 displayField:'title',
344 qtip : "Select a country to add.",
350 store: this.countryStore(),
354 forceSelection: true,
356 triggerAction: 'all',
357 tpl: new Ext.Template(
358 '<div class="x-grid-cell-text x-btn button">',
362 queryParam: 'query[name]',
363 loadingText: "Searching...",
368 setList : function(ar) {
370 Roo.each(ar, function(a) {
374 toList : function() {
376 this.items.each(function(a) {