Book Image

PhoneGap Beginners Guide (third edition)

Book Image

PhoneGap Beginners Guide (third edition)

Overview of this book

Table of Contents (22 chapters)
PhoneGap Beginner's Guide Third Edition
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Related Plugin Resources
Index

Localizing your app


From a development perspective, the common practice is to place the text in resource strings that are loaded at the execution time depending on the user settings. There are several techniques you can use to globalize your app such as storing the translations in portable object (PO) files, creating a JSON object containing all of them, or loading the localization files dynamically when the app starts. The goal is to deploy an app that is able to select the relevant language resource file at runtime and to handle culture-aware number and date parsing and formatting, plurals, currencies, special characters, validation, and so on.

In the following example, we will learn how to load different language strings in the application using a simple JavaScript library.