PDA

View Full Version : [CLOSED] Short Month Dates In French Locale



skirtle
11 Aug 2011, 1:27 PM
ExtJS versions 3.4.0 and 4.0.5 (among others).
All browsers.
All OSes.
Using either ext-lang-fr.js or ext-lang-fr_CA.js.


There's a mistake in both French locale files (i.e. French and Canadian). It's present in both ExtJS 3 and ExtJS 4. Among other problems it causes an Ext.form.field.Date to stop working for some date formats.

The monthNumbers object should use short names. In the French files it's using the long names.

In ExtJS 4 it looks like this:


Ext.Date.monthNumbers = {
"Janvier" : 0,
"Février" : 1,
"Mars" : 2,
"Avril" : 3,
"Mai" : 4,
"Juin" : 5,
"Juillet" : 6,
"Août" : 7,
"Septembre" : 8,
"Octobre" : 9,
"Novembre" : 10,
"Décembre" : 11
};

If you replace that with something like this it fixes it:


Ext.Date.monthNumbers = {};

for (var num = 0 ; num < 12 ; ++num) {
Ext.Date.monthNumbers[Ext.Date.getShortMonthName(num)] = num;
}

The thought occurs that you could maybe move this logic out of the locale files, such that there isn't the need to have the short names duplicated in each locale file.

If you need a test case then something like this will fall over as soon as you start picking dates:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>French Locale Bug</title>

<link rel="stylesheet" type="text/css" href="lib/resources/css/ext-all.css" />

<script type="text/javascript" src="lib/ext-all-debug.js"></script>
<script type="text/javascript" src="lib/ext-lang-fr.js" charset="UTF-8"></script>

<script type="text/javascript">
Ext.onReady(function() {
new Ext.form.field.Date({
format : 'd-M-Y',
renderTo: Ext.getBody()
});
});
</script>
</head>
<body>
</body>
</html>

skirtle
2 Jan 2012, 8:30 PM
This bug is still present in 4.0.7 and 4.1.0-beta-1.

evant
2 Jan 2012, 8:53 PM
It's on our list to review the locale files, thanks for the report.