Phone API Reference - Extended Classes - Language

Desk Phone API features described in this section are deprecated and supported only on the following models: D40, d45, d50, d60, d62, d65, d70

Language

Localization_language library's Language constructor that creates an object used for translating strings. After the object is created, it checks the phone's lang/locale settings and attempts to load any localized string files available. For example, if the phone's locale is set to es_mx (Spanish/Mexico), the Language constructor checks the app's directory for a 'strings-es_mx.js' file and attempts to load language keys from this file. For more information about creating localized apps see Building Localized Apps in the Guides section.

Additionally, the phone's lang/locale settings can be overridden when creating the Language object by passing a langLocale string to the constructor.

 

Require Extended Library: 

var Language = require('localization_language').Language;  //the Language constructor is exported in the Language property

Class Constructor

new Language()

Creates a new Language object.

var lang = new Language(parameters);

Initialization Parameters

Name

Required

Type

Default

Description

Name

Required

Type

Default

Description

langLocale

No

string

en_us

Lang/locale code to use when loading string localization files. The standard format for this string is [lang code]_[locale code] (e.g., es_mx for Spanish/Mexico, en_us for English/US). The lang/locale code corresponds to the last part of a localization file's name (e.g., strings-en_us.js contains the translated strings for English/US).

defaultLangLocale

No

string

en_us

Indicates the language file to use if the app does not have a language file for the phone's chosen language. For example, if the chosen language/locale is fr_fr, but the app does not include the file strings.fr_fr.js, then the app uses the default language file as indicated with this parameter. If no value has been defined, the phone tries to use en_us.

The functionality of this object is included in the  app extended library . It is recommended you use the app library if you wish to use this feature. 

 

Methods

Name 

Description 

Name 

Description 

translate

Look up a language key and test it against the currently specificed language.

 

Return to Documentation Home I Return to Sangoma Support