Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Localising strings in Symbian Web Runtime

From Wiki
Jump to: navigation, search

This code snippet demonstrates how to localise strings in Symbian Web Runtime.

Article Metadata
Code ExampleTested with
Devices(s): Nokia 5800 XpressMusic, Nokia 6220 Classic
Platform(s): S60 5th Edition, S60 3rd Edition FP2
S60 5th Edition
S60 3rd Edition FP2
Keywords: localization
Created: MiGryz (26 Feb 2009)
Last edited: hamishwillee (04 Oct 2012)



To localise the strings, you should place the files for the default language into the root directory of your widget and the localised files into subfolders named "***.lproj", without quotes, where *** is the language code. For example:

/strings.js  (the JavaScript file containing strings for the default language)
    /en.lproj/strings.js  (the JavaScript file containing English strings)
    /ru.lproj/strings.js  (the JavaScript file containing Russian strings)
    /de.lproj/strings.js  (the JavaScript file containing German strings)

For the list of language codes, see Web Runtime localisation support.

Source file: wrtstub.html

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="StyleSheet" href="style/general.css" type="text/css" />
<script type="text/javascript" src="script/common.js" />
<script type="text/javascript" src="strings.js"/>
<script type="text/javascript" src="script/wrtstub.js" />
<title>WRT Stub</title>
<div id="bodyContent" class="bodyContent">
<hr />
<div id="txt"></div>
<hr />

Source file: infoplist.strings

DisplayName = "DEF_Localization"

Source file: en.lproj/infoplist.strings

DisplayName = "EN_Localization"

Source file: de.lproj/infoplist.strings

DisplayName = "DE_Lokalisierung"

Source file: ru.lproj/infoplist.strings

DisplayName = "RU_Локализация"

Source file: localizationStrings.js

// Executes the snippet.
function executeSnippet() {
* Shows a localized string.

function showLocalizedString() {
document.getElementById('txt').innerHTML = '<p>' + mainString + '</p>';

Source file: strings.js

var mainString = 'DEF_Localization';

Source file: en.lproj/strings.js

var mainString = 'English string';

Source file: de.lproj/strings.js

var mainString = 'Deutsch zeile';

Source file: ru.lproj/strings.js

var mainString = 'Русская строка';


Upon installation, the application sets its name according to the currently used language.

When the user selectes the Execute snippet menu item, the application shows a string between two horizontal lines in the currently used language. For example, on a device with English language, the user will see a string in English.

There are strings for English, German, and Russian languages, and one default string.

Supplementary material

This code snippet is part of the stub concept, which means that it has been patched on top of a template application in order to be more useful to developers. The version of the WRT stub application used as a template in this snippet is v1.1.

This page was last modified on 4 October 2012, at 05:59.
65 page views in the last 30 days.