Skip to content
Kerri Shotts edited this page Jan 29, 2014 · 1 revision

(part of _y)

Parameters:

  • translations - a translation dictionary

Returns: nothing

Internally, the translation matrix is a multi-dimensional dictionary. The key is the top level, and the locale forms the second level. The matrix is stored in localizedText, and is available for public inspection if desired.

Both the internal translation matrix and incoming translation dictionary are structured in the same manner. For example:

  { "HELLO":  { "EN-US": "Hello",
                "ES-ES": "Hola" },
    "GOODBYE":{ "EN-US": "Goodbye",
                "ES-ES": "Adios" }
  }

The key is always converted to uppercase prior to storage. The locale is always of the proper representation (even if the value is passed in all lower-case or without a dash).

Usage

  _y.addTranslations (   { "HELLO":  { "EN-US": "Hello",
                                       "ES-ES": "Hola" }
                         }
                     );

This results in a matrix of:

  localizedText: {
                   "HELLO": {
                              "EN-US": "Hello",
                              "ES-ES": "Hola"
                            }
                 }
Clone this wiki locally