You might need to localize widget resources, such as images, to support multiple languages.
To localize widget resources:
Create localized versions of the resources for those languages that require localization.
Store the files into the appropriate language project directories.
Provide default resources in the root directory of your widget.
If a specific language does not require resource localization, the resource files do not need to be included in the corresponding language project directory. When that language is set as the device language, the default resources will be loaded and used.
When loading a localized resource, give the path to the resource file as relative to the widget’s root directory.
The following pieces of code provide an example of widget resource localization for Finnish, English and for a default case:
Finnish flag for the Finnish system language:
[root]\fi.lproj\ flag.png
English flag for the English system language:
[root]\en.lproj\ flag.png
UN flag for any other system language:
[root]\ flag.png
Defined in the JavaScript file that implements the logic of the widget:
var flag = document.createElement(‘img’); flag.setAttribute(‘src’, ‘flag.png’);
The above JavaScript implementation loads and shows the appropriate flag dynamically.