PDA

View Full Version : [FIXED][3.x/2.x] DatePicker month name (translations)



Vladas
29 Mar 2009, 5:01 AM
Please find updated Lithuanian translations attached.

Also, I've found an incorrect localisation issue in Ext.DatePicker:
In method .createMonthPicker() (lines 381 and 382 in ext-2.2.1) there should be this.getShortMonthName(i) called instead of this.monthNames[i].substr(0, 3).

The problem is particulary with Lithuanian language, where two months (August and September) starts with the same first three letters (Rugpjutis and Rugsejis), so it would be nice if you correct DatePicker for displaying short month names using locales.

mjlecomte
24 Jun 2009, 11:14 AM
I copied the above post from separate thread, appears this is still an issue.

evant
25 Jun 2009, 1:18 AM
Fixed in SVN, both branches.

mjlecomte
25 Jun 2009, 4:42 AM
Thought occurred to me, would it have been better to leave the code the way it was, and instead alter the translation to return the values so the function is just called the one time?


(function(){ /*generate the translation*/})()

More work since we would then need to update all translation files.

Condor
25 Jun 2009, 4:54 AM
Your simply suggesting to cache the short month names. That is not going to be any less (or more) work for the translators.

mjlecomte
25 Jun 2009, 4:59 AM
Your simply suggesting to cache the short month names. That is not going to be any less (or more) work for the translators.

I just meant it was less work (for the developer) to update one line in one file, than having to update 45 locale files.

Condor
25 Jun 2009, 5:09 AM
I just meant it was less work (for the developer) to update one line in one file, than having to update 45 locale files.

I don't get it. DatePicker now calls getShortMonthName.

All translations that don't use the first 3 characters of the month as the short month description should override this method.

The translation files (like my dutch translation) already work this way, so I don't see how this is going to be a problem.

mjlecomte
25 Jun 2009, 6:06 AM
My rationale for prior statements above follows...

Originally createMonthPicker() used this.monthNames[i].substr(0, 3). So picks from a static variable.

Prior suggestion was to change that to so createMonthPicker() used Date.getShortMonthName(i). So picks from a function call every time.

I was thinking it would be better to used the cached values. So use something like the "original way". But you're right, it would not require any changes to the 45 locale files, just one method to cache the short month names as a static property similar to the long month names. Something like:



Date.shortMonthNames = (function() {
arr = [];
for (var i = 0, len = Date.monthNames.length; i < len; i++) {
arr.push(Date.getShortMonthName(i));
}
return arr;
})();


So then DatePicker would have createMonthPicker() using this.shortMonthNames[i]. So picking from a static variable.

Condor
25 Jun 2009, 6:16 AM
I would agree, but it doesn't work because the locale file is loaded AFTER the DatePicker code in ext-all.js.

mjlecomte
25 Jun 2009, 6:58 AM
I would agree, but it doesn't work because the locale file is loaded AFTER the DatePicker code in ext-all.js.

Too true, which then puts me back at the applying something in all locale files. :)

mystix
25 Jun 2009, 9:36 AM
how about a compromise -- an internal cache?


Ext.apply(Date, {
getShortMonthName : function() {
var smn = [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec',
]; // internal short month name cache

return function(month) {
return smn[month % 12];
}
}()
});

which is how i envision the locale files would implement the getShortMonthName() method.
(sorry -- can't remember what @condor's dutch translation looks like).