Similar questions that don't give complete answers:
- How to localize Cordova iOS projects?
- How to localise a string inside the iOS info.plist file?
- How to localize an iphone app for different languages?
- How to localize app name in cordova for iOS?
problem
The app I'm currently working on needs some localized strings, but I'm having a hard time finding the correct cordova/apple docs that tell me exactly how to setup the correct file directory.
What I understand
- You need to have a
InfoPlist.strings
resource file for every locale in your app. - This file follows a
key = "value";
format - You need to set
CFBundleLocalizations
in your config.xml and list the locales in your app:
<config-file parent="CFBundleLocalizations" target="*-Info.plist">
<array>
<string>en</string>
<string>es</string>
</array>
</config-file>
What I do not understand
Is there some cordova config I need to add which sets up my folder structure correctly? In xcode's project editor help it states
In the Project navigator, every resource that is localized becomes a group containing the language-specific resources. For user interface files, the group contains the user interface file for the base language and a strings file for each additional language (the strings file has the same name as the user interface file but with a .strings file extension). For example, if you add German, Main.storyboard becomes a group containing Main.storyboard (Base) and Main.strings (German).
In the file system, Xcode creates a separate language folder to store the language-specific resources. The name of the folder is the language ID followed by the .lproj file extension—for example, de.lproj. if you choose German (de) from the language menu. Xcode adds the language-specific strings files for each user interface file to the language folder. The strings files that Xcode creates contain placeholders for the localizable text. Later, you’ll export and import these language folders for localization.
Doing any of this manually in xcode (outside of cordova) defeats the purpose of automating this with cordova. My current project structure looks like
package.json
config.xml
platforms/
ios/
cordova/
CordovaLib/
platform_www/
www/
dev-app.xcodeproj/
dev-app.xcworkspace/
dev-app/
config.xml
dev-app-Info.plist
Xcode project editor help gives me a picture of a correctly setup project, how do I use cordova (hooks maybe, whatever) to get this setup?