s.webbandit
s.webbandit

Reputation: 17010

How to apply localization in ExtJS 4

Is there default way to apply localization packet globaly to all Application from /extjs/locale/ in ExtJS 4.1 MVC?

Maybe some Ext.Application or Ext.Loader metods/properties?

Upvotes: 4

Views: 8485

Answers (2)

cwtuan
cwtuan

Reputation: 1861

(You can also load locale file dynamically via JS)

To localizate Built-in Ext JS component, add the following code your 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); }

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

Upvotes: 1

ypan
ypan

Reputation: 173

I don't think so. You have to 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>

Upvotes: 5

Related Questions