How to apply localization in ExtJS 4

Is there a default way to apply globaly package localization to all applications from /extjs/locale/ in ExtJS 4.1 MVC?

Perhaps some Ext.Application or Ext.Loader methods / properties?

+4
source share
2 answers

I do not think so. You must load the appropriate file in extjs / locale /

For example (tomcat server), in index.jsp you can do something like

 <script type="text/javascript" src="extjs/locale/ext-lang-<%=language %>.js"></script> 
+5
source

(You can also dynamically load the locale file via JS)

To localize the Ext JS built-in component, add the following code: app.js : launch: function() { var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.type = 'text/javascript'; script.src = "extjs/locale/ext-lang-" + navigator.language; head.appendChild(script); } launch: function() { var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.type = 'text/javascript'; script.src = "extjs/locale/ext-lang-" + navigator.language; head.appendChild(script); }

To localize a custom Ext JS component, use Locale.js . We used it in two Ext JS projects. Pretty simple.

+1
source

All Articles