HERE Maps API - Setting the language
m (Jasfox - Add link.) |
m (Jasfox - add monospacing.) |
||
| Line 38: | Line 38: | ||
</code> | </code> | ||
| − | For the language, define it in format of ISO3166-1 alpha-2 country code, e.g. | + | For the language, define it in format of ISO3166-1 alpha-2 country code, e.g. {{Icode|en-US}}, {{Icode|de-DE}} and so on. |
== Getting more language information == | == Getting more language information == | ||
| − | When you want to display more information, use the class nokia.maps.language.Info. | + | When you want to display more information, use the class {{Icode|nokia.maps.language.Info}}. |
| − | It has a method called | + | It has a method called {{Icode|getDefinition (code, [definitions]) : Object}}. |
| − | This will retrieve the language meta data for a given LCID. The | + | This will retrieve the language meta data for a given LCID. The look up will be done in two steps: |
First the full LCID (ISO-639-1 AND ISO-3166-1 alpha-2) will be matched. If the full LCID cannot be found | First the full LCID (ISO-639-1 AND ISO-3166-1 alpha-2) will be matched. If the full LCID cannot be found | ||
the more general form (ISO-639-1 only) will be matched. | the more general form (ISO-639-1 only) will be matched. | ||
| − | An example of using the getDefinition: | + | An example of using the {{Icode|getDefinition()}} method: |
| − | <code | + | <code javascript> |
| − | + | mylanguage = nokia.maps.language.Info; | |
</code> | </code> | ||
Would return: | Would return: | ||
| − | <code | + | <code javascript> |
Object { definitions={...}, translations={...}, more...} | Object { definitions={...}, translations={...}, more...} | ||
</code> | </code> | ||
| Line 63: | Line 63: | ||
then... | then... | ||
| − | <code | + | <code javascript> |
| − | + | mylanguage.getDefinition("de-DE"); | |
</code> | </code> | ||
would return e.g: | would return e.g: | ||
| − | <code | + | <code javascript> |
Object { key="de", iso639_1="de", more...} | Object { key="de", iso639_1="de", more...} | ||
</code> | </code> | ||
Revision as of 13:22, 17 April 2012
This article explains how to set the map interface language and how to display more language information
Article Metadata
Compatibility
Article
Setting the map interface language
To set the language, use the following:
nokia.maps.packages.load("language", "de-DE");
For the language, define it in format of ISO3166-1 alpha-2 country code, e.g. en-US, de-DE and so on.
Getting more language information
When you want to display more information, use the class nokia.maps.language.Info.
It has a method called getDefinition (code, [definitions]) : Object.
This will retrieve the language meta data for a given LCID. The look up will be done in two steps: First the full LCID (ISO-639-1 AND ISO-3166-1 alpha-2) will be matched. If the full LCID cannot be found the more general form (ISO-639-1 only) will be matched.
An example of using the getDefinition() method:
mylanguage = nokia.maps.language.Info;
Would return:
Object { definitions={...}, translations={...}, more...}
then...
mylanguage.getDefinition("de-DE");
would return e.g:
Object { key="de", iso639_1="de", more...}
Summary
Please check out the chapter http://api.maps.nokia.com/2.1.0/apireference/symbols/nokia.maps.language.html for more information on languages.

