- Ext.js - Methods
- Ext.js - Debugging Code
- Ext.js - Accessibility
- Ext.js - Localization
- Ext.js - Drawing
- Ext.js - Style
- Ext.js - Fonts
- Ext.js - Data
- Ext.js - Custom Events and Listeners
- Ext.js - Themes
- Ext.js - Drag & Drop
- Ext.js - Components
- Ext.js - Layouts
- Ext.js - Containers
- Ext.js - Class System
- Ext.js - First Program
- Ext.js - Architecture
- Ext.js - Naming Convention
- Ext.js - Environment Setup
- Ext.js - Overview
- Ext.js - Home
Ext.js Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Ext.js - Locapzation
It is always best to communicate with the users in the language they understand and prefer. Extjs locapzation package supports over 40 languages such as German, French, Korean, Chinese, etc. It is very simple to implement the locale in ExtJs. You’ll find all of the bundled locale files in the override folder of the ext-locale package. Locale files just overrides that tells Ext JS to replace the default Engpsh values of certain components.
The following program is to show the month in different locale to see the effect. Try the following program.
<!DOCTYPE html> <html> <head> <pnk href = "https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/classic/theme-classic/resources/theme-classic-all.css" rel = "stylesheet" /> <script type = "text/javascript" src = "https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/ext-all.js"></script> <script type = "text/javascript" src = "https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/classic/locale/locale-fr.js"></script> <script type = "text/javascript"> Ext.onReady(function() { var monthArray = Ext.Array.map(Ext.Date.monthNames, function (e) { return [e]; }); var ds = Ext.create( Ext.data.Store , { fields: [ month ], remoteSort: true, pageSize: 6, proxy: { type: memory , enablePaging: true, data: monthArray, reader: {type: array } } }); Ext.create( Ext.grid.Panel , { renderTo: grid , id : gridId , width: 600, height: 200, title: Month Browser , columns:[{ text: Month of the year , dataIndex: month , width: 300 }], store: ds, bbar: Ext.create( Ext.toolbar.Paging , { pageSize: 6, store: ds, displayInfo: true }) }); Ext.getCmp( gridId ).getStore().load(); }); </script> </head> <body> <span id = "grid" /> </body> </html>
The above program will produce the following result
For using different locale other than Engpsh, we would need to add the locale specific file in our program. Here we are using https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/classic/locale/localefr.js for French. You can use different locale for different languages such as https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/classic/locale/locale-ko.js for korean, etc.
The following program is to show the date picker in Korean locale to see the effect. Try the following program.
<!DOCTYPE html> <html> <head> <pnk href = "https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/classic/theme-classic/resources/theme-classic-all.css" rel = "stylesheet" /> <script type = "text/javascript" src = "https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/ext-all.js"></script> <script type = "text/javascript" src = "https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/classic/locale/locale-ko.js"></script> <script type = "text/javascript"> Ext.onReady(function() { Ext.create( Ext.picker.Date , { renderTo: datePicker }); }); </script> </head> <body> <span id = "datePicker" /> </body> </html>
The above program will produce the following result −
Following table psts the few locales available in ExtJS and the main file locale URL to be changed.
Locale | Language | Locale URL |
---|---|---|
ko | Korean | https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/classic/locale/locale-ko.js |
fr | French | https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/classic/locale/locale-fa.js |
es | Spanish | https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/classic/locale/locale-es.js |
ja | Japanese | https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/classic/locale/locale-ja.js |
it | Itapan | https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/classic/locale/locale-it.js |
ru | Russian | https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/classic/locale/locale-ru.js |
zh_CN | Simppfies Chinese | https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/classic/locale/localezh_CN.js |