iOS How to localize for both Spain and international? - ios

I want to have a specific version of Localizable.strings file to serve for people in Spain. However, in the case of general Spanish, i want to serve a different file.
Where is the documentation on how this is done?
or is it just that i need two Localizable.strings files in both es.lproj and es-ES.lproj ?
Also, is it as easy as just creating the folder es.lproj with Localizable.strings file, and then in xCode do "Add files to project" ?

What you should do is to localize your xcode project. The document for xcode project localization is here(https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/LocalizingYourApp/LocalizingYourApp.html)
There are different Spanish language, such as Spanish-Mexico(es-mx) and Spanish-Peru(ex-pe). Please refer to here for more details(http://www.science.co.il/Language/Locale-codes.asp).
And if you just need to support Spanish - Spain (Traditional) language, either es or es-ES is Okay.
Creating the folder es.lproj with Localizable.strings file is not work for localization. You should localize the project. Please refer to 1 or here(How to localize my app with Xcode 4?) for project localization.

Related

0 localized files seen in xcode for native development language

I'm working on a project where I need to add localize file of another language in xcode.
But when I try to add new language, it does not show me list of the base storyboards. Like given below
Also I'm seeing that 0 files localized for english - development language.
Anyone having any idea about it ?
you should localize files you need, then those files will be present in list of localizable resources

In iOS how can I remove languages from Localizable.strings with Xcode

This is how my xcode project looks. I would like to remove the Localizable.strings for UK and US and just keep the Localizable.strings for English. How can I do this?
Follow the instructions in the image below
You can just select the specific files and delete them from the project. Just make sure that in the file inspector as well they are removed for the Localizable.strings.

When is Base.lproj used?

I am trying to understand Base.lproj but I am not still understanding it. If I create a new simple project with a view controller and Swift+Storyboard in XCode 6 beta 4 I get a Base.lproj folder out of the box containing the storyboard file.
I then add a simpel NSLocalizedString(...) in my view controller for testing purposes. This requires a Localizable.strings file. When I create one should I add it in the Base.lproj or should I add it in a specific language folder?
If I change the Localization native development region key in Info.plist to de for german and I no Localizable.strings file for de in the de.lproj folder it seems to fallback on Base.lproj if Localizable.strings file is found there. However, if I add a Localizable.strings file in the de.lproj folder but don't add the property (key + value) the app fails during runtime. It seems like Base.lproj isn't searched.
I don't understand which language Base is and when it is used? Is it only for Storyboard files?
I was under the impression that base.lproj is used in cases where the current language/ localisation file does not have a property key. For instance if I do have Main_Title = "Title Text"; in base.lproj and absent in en.lproj while the current language is English, I assumed iOS will find it in base.lproj but that is not the case.
Your initial conclusion is correct:
Base is only used when you did not support that language in localizable.strings
The specific language localizable.strings folder is used when device/ app is using that language
If you do not provide support for a specific file/ string key in a language and you have a folder for that language, it will throw run-time warning
In case of storyboard files and xibs if you only have base.lproj folder which contains your views, notwithstanding how many languages you support, it will not fail (this is what I am doing as well).

Resource files are not displaying in Localization

Only one Resource file is displaying When i'm adding Localizable.strings file for any language. My steps are,
Selected My main app's project file in xcode and found info option is there
in info - Localization - + option
Note: there is only one resource file (InfoPlist.strings) is available to add Language.
3- then Finish, but there is no Localizable.strings file is displaying in xcode but there is InfoPlist.strings file displaying.
But if i do these same steps in sample app which is working fine , I can able to select Multiple resource files And also I can see many Localizable.strings & InfoPlist.strings
in xcode.
Like:
Localizable.strings (English)
Localizable.strings (Spanish)
InfoPlist.Strings (English)
InfoPlist.Strings (Spanish)
Can anyone please tell me the solution to add multiple resource files when localizing any language?
If you want to make your app to support multiple languages, then you'll need to add .strings files to your project, make sure that you should name it "Localizable.strings" only, and need to put in particular language folder,
See this question and my answer there,
Localized filename should always be named Localizable.strings, and that file is within the particular language folder, for English, en.lproj and for French fr.lproj like wise.
Localizable.strings file should be inside the Base.lproj folder.

Localization for new Files in older Project breaks App

Good evening
I want to add a new year, a new volume as plist-file to my existing app. The app is localized for 4 languages, so the new file has to be localized also. The languages were "English", "German", "French" and "Italian".
But when I do this, Xcode creates a directory "de.lproj" next to the existing "German.lproj", same behaviour for French and Italian, but not English. The older localized files are now in a directory "German.lproj", the newly generated plist in a folder called "de.lproj".
Then the app will no longer recognize the localized strings, exept the english version.
How can I add a new localized file to this project without breaking the rest?
Regards
You should use Localization Suite to manage your translations. This way, you can let loc-suite to scan changes in your original .plist file and tell you which ones are translated and which ones are not. Loc-suite can also update your localized .plist file and remove dead entries.
This question is slightly off topic at stackoverflow though.
Finally I solved the problem like this:
Make a backup of each localized file (plist and strings files) in the Finder and collect them in a folder for each language.
In Xcode, remove every localization for these files so that the only remaining language is English.
In Finder, delete the old lproj directories in the project folder except English.lproj.
In Xcode, add the formerly deleted localizations for each file. Copy the contents of the files into the newly generated localized files.
Maybe this can help somebody.

Resources