Localization of Xcode PhoneGap

I hit my head against a wall for 2 days trying to add local localization to my application. The application uses PhoneGap 1.1, and I'm trying to create it using Xcode 4.1

I was looking for information / tutorial / everything starting from 2 days, but I could not find anything detailed. Thus, either this is a trivial problem, and I cannot understand it, or it is an unusual problem.

Many of the streams I saw explain that I have to create a new folder in the Resources section and add the following folders to the project (let's say I want my application to be localized in French and for non-French speaking countries):

- locales

--- en

---- local.strings

--- fr

---- local.strings

Now I have problems: firstly, what should I consider as my project root folder? All of my code is in the www folder, and as I understand it, this main node PG looks when it does its job. Therefore, I assume that I need to create "locales" under "www".

Assuming this is the right place, I should enter key-value pairs in the .strings file. Now, how can I tell Xcode which lines to look for on my index.html page? In Objective-C, this is done by calling NSLocalizedString(@"StringKey") , but since I use PG, I have either plain HTML or JS to use. Is there a built-in method for this?

Is this the wrong approach? Any hint, tutorial, documentation, reference on this issue will be very useful.

+4
source share
1 answer

Phonegap is organized differently.

The www / index.html file is loaded as a webView from the DroidGap class. This, at least from my understanding, is the only point (besides the Javascript Plugin) where you can intercept the loading of the html page and apply any parsing of the localization. After rendering www / index.html, any additional links are either processed internally (multi-page approach) or through links to "external" (single-page) html pages.

If no Javascript callback method is reached, non-standard PhoneGap classes are used for it and, therefore, iOS classes are not assigned.

PhoneGap plugins provide Javascript-Bridge for their own coding environment and therefore can be used to provide localization.

Just found a thread that might help:

http://community.phonegap.com/nitobi/topics/problem_with_binary_details_ios_localization_builded_with_phonegap_build?from_gsfn=true

+1
source

All Articles