PDA

View Full Version : Localization



stoertebeker
21 Apr 2012, 12:36 PM
Hi,
after reading all threads and documentation about localization I am still not able to get it to work, although I thought it should be pretty straight forward. All I want, is to change the localization to ‘en-GB’ in order to have dates and numbers in European style.
From what I learned, I have located the locale file and included it in the html file that is called from the browser:



<!DOCTYPE html>


<!-- Auto Generated with Sencha Architect -->
<!-- Modifications to this file will be overwritten. -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>userlist</title>
<link rel="stylesheet" type="text/css" href="../ext-4.0.7-gpl/resources/css/ext-all.css"/>
<script type="text/javascript" src="../ext-4.0.7-gpl/ext-all-debug.js"></script>
<script type="text/javascript" src="../ext-4.0.7-gpl/locale/ext-lang-en_GB.js"></script>
<script type="text/javascript" src="app.js"></script>
</head>
<body></body>
</html>

The app is MVC style and pretty lean as well:



Ext.Loader.setConfig({
enabled: true
});


Ext.application({
models: [
'User'
],
stores: [
'User'
],
views: [
'MyGridPanel'
],
autoCreateViewport: true,
name: 'MyApp'
});

The only thing that happens is that the grid data is loaded via autoLoad from the assigned store. Unfortunately the date fields are still in US-style (m/d/Y).


Any hint or suggestion is welcome.

skirtle
21 Apr 2012, 9:46 PM
What do you mean by 'date fields'? There are actually a few things that could refer to.

stoertebeker
22 Apr 2012, 1:02 AM
Date as the unique identifier of a specific day, e.g. todays 'date' is 22nd April 2012. And a date field would be a space on the screen that conatins such a date in a specific format (US style would be: 4/22/2012; European style would be: 22.4.2012).

skirtle
22 Apr 2012, 1:32 AM
Let me rephrase...

By 'date field' do you mean Ext.form.field.Date or do you mean a field on your model that has type date? Or something else entirely?

stoertebeker
22 Apr 2012, 1:54 AM
ok, what I have 'internally' is a model that has a field of type 'Ext.data.Field' with the property 'type: date'. And in the grid panel I have a field of type 'Ext.grid.column.Date' which is related to the model-field via the 'dataIndex'. Hope that is the information you were looking for.

skirtle
22 Apr 2012, 2:14 AM
OK, it looks like date column localization is missing from the en_GB file. If you take a look in the German file you'll see an example of what it should look like:


if(Ext.grid.DateColumn){
Ext.apply(Ext.grid.DateColumn.prototype, {
format : 'd.m.Y'
});
}

You'll need to add something similar for en_GB.