Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Dave Weitzel
AUI Javascript Localization
March 22, 2012 12:54 PM
Answer

Dave Weitzel

Rank: Regular Member

Posts: 205

Join Date: November 18, 2009

Recent Posts

Some of the AUI javascripts (pagination for example) have English text in them - "Total", "of" , "pages" etc

How can I dynamically change these according to the locale of the page?

Quite happy to be changing both the js file and where it is called whenever I find it our UI hook a=has many files in it already. emoticon
André Bunse
RE: AUI Javascript Localization
March 22, 2012 7:52 PM
Answer

André Bunse

Rank: Junior Member

Posts: 85

Join Date: March 15, 2012

Recent Posts

Something like this, only a little change

File: %TOMCAT_HOME%/webapps/ROOT/html/js/aui/aui-paginator/aui-paginator.js
 1
 2            totalLabel: {
 3                getter: function() {
 4                    var instance = this;
 5                   
 6                    return L.sub(TOTAL_LABEL_TPL, {
 7                        total: instance.get(TOTAL)
 8                    });
 9                },
10                validator: isString
11            },

change to

1              var translated_label = Liferay.Language.get([u][i]"totalLabel"[/i][/u]);
2              return L.sub(TOTAL_LABEL_TPL.replace("Total", translated_label), {

and create the wanted translations under server:8080/language/xx_XX/

hope that points you in the right direction, too late for a further look ;)

André