Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Dave Weitzel
AUI Javascript Localization
22. März 2012 12:54
Antwort

Dave Weitzel

Rang: Regular Member

Nachrichten: 203

Eintrittsdatum: 18. November 2009

Neue Beiträge

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
22. März 2012 19:52
Antwort

André Bunse

Rang: Junior Member

Nachrichten: 85

Eintrittsdatum: 15. März 2012

Neue Beiträge

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é