You might need to localize widget resources, such as images, to support multiple languages.
Create localized versions of the resources for the languages that require localization.
Store the files into the appropriate language project directories.
Provide default resources in the widget root directory.
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 are loaded and used.
When loading a localized resource, specify the path to the resource file as relative to the widget root directory.
The following pieces of code provide an example of widget resource localization for Finnish, English and for a default case.
Add the Finnish flag for use when system language is Finnish:
[root]\fi.lproj\ flag.png
Add the English flag for use when the system language is English:
[root]\en.lproj\ flag.png
Add the UN flag for use with any other system language:
[root]\ flag.png
In the JavaScript file that implements the logic of the widget, create the following code to load and show the appropriate flag dynamically. :
var flag = document.createElement('img'); flag.setAttribute('src', 'flag.png');