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 Roo.each(Pman.I18n.Data[lang], function(d) {
57 * zh_HK,en to [ { code=zh_HK, title=Chinese }, .... ]
58 * @arg type type (c = country, l = lang)
59 * @arg codes list of languages
61 listToObjects: function (type, codes)
68 var cl = codes.split(',');
69 Roo.each(cl , function(c) {
72 title : _this.toName(type,c)
80 reader : { // std. reader for i18n items.
82 totalProperty : 'total',
91 countryStore : function() { return {
97 url: baseURL + '/I18N/Country.html',
101 reader: Pman.I18n.reader,
104 loadexception : Pman.loadException
109 field: 'title', direction: 'ASC'
114 languageStore: function() {return{
119 url: baseURL + '/I18N/Lang.html',
123 reader: Pman.I18n.reader,
126 loadexception : Pman.loadException
131 field: 'title', direction: 'ASC'
135 currencyStore: function() {return{
140 url: baseURL + '/I18N/Currency.html',
144 reader: Pman.I18n.reader,
147 loadexception : Pman.loadException
152 field: 'title', direction: 'ASC'
156 country: function(cfg) {
160 // things that might need chnaging
161 name : 'country_title',
162 hiddenName : 'country',
165 fieldLabel : "Country",
169 qtip : "Select Country",
174 store: this.countryStore(),
175 displayField:'title',
180 triggerAction: 'all',
181 //emptyText:'Select a state...',
187 language: function(cfg) {
191 // things that might need chnaging
193 name : 'language_title',
194 hiddenName : 'language',
197 fieldLabel : "Language",
201 qtip : "Select Language",
206 store: this.languageStore(),
207 displayField:'title',
213 triggerAction: 'all',
214 //emptyText:'Select a state...',
220 currency: function(cfg) {
224 // things that might need chnaging
225 name : 'currency_title',
226 hiddenName : 'currency',
229 fieldLabel : "Currency",
233 qtip : "Select Currency",
238 store: this.currencyStore(),
244 triggerAction: 'all',
245 //emptyText:'Select a state...',
247 tpl: new Ext.Template(
248 '<div class="x-grid-cell-text x-btn button">',
249 '{title} ({code})</b>',
256 languageList : function(cfg) {
263 fieldLabel : "Language(s)",
266 renderer : function(d) {
267 return String.format('{0}', d.title );
271 xtype: 'ComboBoxLister',
272 displayField:'title',
275 qtip : "Select a language to add.",
281 store: this.languageStore(),
285 forceSelection: true,
287 triggerAction: 'all',
288 tpl: new Ext.Template(
289 '<div class="x-grid-cell-text x-btn button">',
293 queryParam: 'query[name]',
294 loadingText: "Searching...",
299 setList : function(ar) {
301 Roo.each(ar, function(a) {
305 toList : function() {
307 this.items.each(function(a) {
317 countryList : function(cfg) {
324 fieldLabel : "Country(s)",
327 renderer : function(d) {
328 return String.format('{0}', d.title );
332 xtype: 'ComboBoxLister',
333 displayField:'title',
336 qtip : "Select a country to add.",
342 store: this.countryStore(),
346 forceSelection: true,
348 triggerAction: 'all',
349 tpl: new Ext.Template(
350 '<div class="x-grid-cell-text x-btn button">',
354 queryParam: 'query[name]',
355 loadingText: "Searching...",
360 setList : function(ar) {
362 Roo.each(ar, function(a) {
366 toList : function() {
368 this.items.each(function(a) {