-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
PhoneGap Beginners Guide (third edition)
By :
Refer to the following steps to render different messages in your app according to the device's language settings:
Open the command-line tool and create a new PhoneGap project called Globalization:
$ cordova create Globalization
Add the Globalization API plugin using the following command:
$ cordova plugin add cordova-plugin-globalization
Using the command-line tool, add the platform you want to use for this test (Android, Blackberry, iOS, or Windows Phone 8):
$ cordova platforms add android
Download and save the l10n.js file available at https://github.com/marcelklehr/html10n.js in the www/js folder.
Go to the www folder and create the JSON file named langs.json to store all the required language strings as shown here. A JSON file format is a simple way of storing data like XML. The file will have the same literals repeated for each language:
{
“en”: {
“welcome”: “Welcome”,
“english”: “English”,
“french”: “French”,
“alert”: ...
Change the font size
Change margin width
Change background colour