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 Roo.each(Pman.Login.authUser.i18n[type], function(d) {
56 * zh_HK,en to [ { code=zh_HK, title=Chinese }, .... ]
57 * @arg type type (c = country, l = lang)
58 * @arg codes list of languages
60 listToObjects: function (type, codes)
67 var cl = codes.split(',');
68 Roo.each(cl , function(c) {
71 title : _this.toName(type,c)
79 reader : { // std. reader for i18n items.
81 totalProperty : 'total',
90 countryStore : function() { return {
96 url: baseURL + '/I18N/Country.html',
100 reader: Pman.I18n.reader,
103 loadexception : Pman.loadException
108 field: 'title', direction: 'ASC'
112 languageStore: function() {return{
117 url: baseURL + '/I18N/Lang.html',
121 reader: Pman.I18n.reader,
124 loadexception : Pman.loadException
129 field: 'title', direction: 'ASC'
132 currencyStore: function() {return{
137 url: baseURL + '/I18N/Currency.html',
141 reader: Pman.I18n.reader,
144 loadexception : Pman.loadException
149 field: 'title', direction: 'ASC'
153 country: function(cfg) {
157 // things that might need chnaging
158 name : 'country_title',
159 hiddenName : 'country',
162 fieldLabel : "Country",
166 qtip : "Select Country",
171 store: this.countryStore(),
172 displayField:'title',
177 triggerAction: 'all',
178 //emptyText:'Select a state...',
183 language: function(cfg) {
187 // things that might need chnaging
189 name : 'language_title',
190 hiddenName : 'language',
193 fieldLabel : "Language",
197 qtip : "Select Language",
202 store: this.languageStore(),
203 displayField:'title',
209 triggerAction: 'all',
210 //emptyText:'Select a state...',
216 currency: function(cfg) {
220 // things that might need chnaging
221 name : 'currency_title',
222 hiddenName : 'currency',
225 fieldLabel : "Currency",
229 qtip : "Select Currency",
234 store: this.currencyStore(),
240 triggerAction: 'all',
241 //emptyText:'Select a state...',
243 tpl: new Ext.Template(
244 '<div class="x-grid-cell-text x-btn button">',
245 '{title} ({code})</b>',
252 languageList : function(cfg) {
259 fieldLabel : "Language(s)",
262 renderer : function(d) {
263 return String.format('{0}', d.title );
267 xtype: 'ComboBoxLister',
268 displayField:'title',
271 qtip : "Select a language to add.",
277 store: this.languageStore(),
281 forceSelection: true,
283 triggerAction: 'all',
284 tpl: new Ext.Template(
285 '<div class="x-grid-cell-text x-btn button">',
289 queryParam: 'query[name]',
290 loadingText: "Searching...",
295 setList : function(ar) {
297 Roo.each(ar, function(a) {
301 toList : function() {
303 this.items.each(function(a) {
312 countryList : function(cfg) {
319 fieldLabel : "Country(s)",
322 renderer : function(d) {
323 return String.format('{0}', d.title );
327 xtype: 'ComboBoxLister',
328 displayField:'title',
331 qtip : "Select a country to add.",
337 store: this.countryStore(),
341 forceSelection: true,
343 triggerAction: 'all',
344 tpl: new Ext.Template(
345 '<div class="x-grid-cell-text x-btn button">',
349 queryParam: 'query[name]',
350 loadingText: "Searching...",
355 setList : function(ar) {
357 Roo.each(ar, function(a) {
361 toList : function() {
363 this.items.each(function(a) {