Provide localized content for languages not supported by iOS

//Provide localized content for languages not supported by iOS

Provide localized content for languages not supported by iOS

During app development I was asked to provide localized strings in urdu, a language spoken in some region in India and Pakistan. Urdu is not available on the iPhone as language but as region setting only. That means that you would have localized number formatting (date/time/phone number etc.) but strings would never been seen in a localized fashion.
Here is what I did to overcome that situation.

1. in Xcode add the localizations to your project (here ur, ur-IN, ur-PK). This step is necessary as localizedStringFromNumber relies on the existence of project folders with the corresponding identifier (ur-IN.lproj) even if there is nothing in it. In my case I worked with a storyboard in english only and provided localized UI strings from a bundle with localized strings.
2. create a bundle file
I use bundles a lot to keep things together on one place especially with image resources or when there is chance that I need provide a „drop-in“ functionality on other projects.

3. with your bundle create the same project folders you see in your main project directory.
4. within your lproj directories place UTF16 (to be on the save side when it comes to Japanese/Chinese an alike) text files (en.lproj/Localizable.strings).
NOTE: The name you use is your TableName you have to use in Globals.m

5. Add Globals.h/Globals.m to your project and you are done

Usage
CustomLocalized(@“TextToBeLocalized“)

By |2018-06-06T20:31:54+00:00Freitag, November 16th, 2012|Development|0 Comments

About the Author:

Leave A Comment

For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

I agree to these terms.