How to implement multi-language support?

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

Choosing one of the supported languages for the application depending on the TV settings

The easiest way for multi-language support is by using the App Framework, in this case the SmartHub language detection and including the right file is done automatically.

See also

Multi-Language Support
More information on Application Framework language-detection mechanism.

This approach supports only choosing the right language pack at the app initialize and does not support changing the language during application lifetime.

If your application does not use the Application Framework, the basic functions still can be used from the Framework core (the path is: '$MANAGER_WIDGET/Common/af/2.0.0/loader.js', it requires jquery to be included first). On the application init the SmartHub language can be checked using the function:


And after that, the proper language file can be included using

sf.core.loadJS(file, callback);

If there is a need to change the language during application lifetime, this can be done by simply loading another language file, which will overwrite the previous one. In this case however, the whole UI needs to be refreshed in the callback function.