top

Multi-Language Support

Published 2014-10-27 | (Compatible with SDK 3.5,4.5,5.0,5.1 and 2012,2013,2014 models)

Rules for preparing Smart TV apps supporting many languages.

Samsung Smart TV supports many languages set by the OSD (on-screen display) menu.

To set the language:

  1. On the remote control, press the MENU key.
  2. Select System > Menu Language.

The application receives this language code using sf.core.getEnvValue(‘lang’). The Framework API loads the language resource automatically.

Setting the Supported Language

To define the languages the application supports, add the languages property in the app.json file. It must contain language codes in the ISO 639-1 standard. For more information, see Language Code and http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes.

{
    ...
    "languages" : ["en",  "ko", "fr"],
    ...
}

In this sample, the application supports English, Korean and French. The first value en is the default language. If the language code from the OSD setting is not supported in the widget, the first value en is included by default. The language files must be located in the lang directory and named in the form [languagecode].js. The corresponding language file is included automatically during the initialization of the application.

Figure: Language files folder structure

The contents of the language resource files are given below.

en.js

alert("English (en) loaded");
var STR_YES = "Yes";
var STR_NO = "No";
...

fr.js

alert("French (fr) loaded");
var STR_YES = "Oui";
var STR_NO = "Non";
...

ko.js

alert("Korean (ko) loaded");
var STR_YES = "예";
var STR_NO = "아니오";
...

Use STR_YES and STR_NO in the application.