I have a Phonegap app, where I use the camera plugin. The problem is, that the buttons doesn't use the native iOS language, instead they're only english ('Retake' and 'Use' etc.).
The app I'm doing is an app for children, but they're not native english speakers. So I would like to have it in their native language.
Is there any way I can translate those buttons into the correct language?
I was able to change the label languages by modifying the project plist (platforms/ios/ProjectName/ProjectNAme-Info.plist
).
I changed CFBundleDevelopmentRegion
from English
to fr_FR
and added this array:
<key>CFBundleLocalizations</key>
<array>
<string>fr</string>
</array>
If you are using XCode as IDE to develop your project, you can localize it as a normal iOS project. To know how do that you can check in this other post. You will not need to provide the translation for those "words" (Retake, Use and etc), just setting the proper localizations will tell the iOS to use the native language.
But, if you are using PhoneGap Build to compile your project, check this topic in the PhoneGap Build forum. Similar with the XCode procedure, you will need to create a folder called "locales" under your /www directory and put there the languages you want use. Again, you don't need to provide the translation for that buttons. The iOS will do by itself.
If you don't want to manually change the language in XCode after each build, you can do the following updates in the phonegap/cordova source code on your Mac :
(Example with cordova 3.6.3 and French locale, you need to update to your version & language)
Folder : ~\.cordova\lib\npm_cache\cordova-ios\3.6.3\package\bin\templates\project\__PROJECT_NAME__\
File : __PROJECT_NAME__-Info.plist
Update :
=> Change <key>CFBundleDevelopmentRegion</key>
<string>English</string>
to <key>CFBundleDevelopmentRegion</key>
<string>France</string>
=> Add after it
<key>CFBundleLocalizations</key>
<array>
<string>fr</string>
</array>
Folder : ~\.cordova\lib\npm_cache\cordova-ios\3.6.3\package\bin\templates\project\__PROJECT_NAME__\Resources\
Update :
=> Create a 'fr.lproj' folder by Copy/Paste of the 'en.lproj' folder
=> Complete the translation in 'fr.lproj/Localizable.strings' file (not required)
This will affect all the projects that you build with this cordova version.
Backup your cordova folder before and don't leave unwanted files under the 'templates' folder or they will be copied in the final package.
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With