Skip to content


Subversion checkout URL

You can clone with
Download ZIP

GetText micro library

simonc edited this page · 1 revision
Clone this wiki locally

In order to use the GetText translations in your script, you need to use the GetText micro library API.


The GetText variable is an instance of the GettextJson class. Use this variable to access the API.


locale is the attribute to use when you want to set the locale to use :

GetText.locale = 'fr';

default_locale contains the default locale to use (‘en’ by default) :

GetText.default_locale = 'de';

translations contains all the translations :

GetText.translations = {
    "fr": {
        "Hello World": "Bonjour le Monde",
        "How are you ?": "Comment allez-vous ?"


GetText.current_locale() Returns the currently used locale.

GetText.translate(string) Returns the translation of a string if it exists, otherwise the string itself is returned.

GetText.t(string) in an alias for GetText.translate(string).

Something went wrong with that request. Please try again.