Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test localized string on simulator?

Tags:

iphone

I am using NSLocalizedString(); function for my localized strings. Even though i change my preferred language in simulator settings my string still get shown up in English.

Can we test the NSLocalizedString(); from simulator? if so how?

Can any one guide me through this please?

-- Regards,

U'suf

like image 839
user272312 Avatar asked Feb 14 '10 13:02

user272312


People also ask

What does localized string mean?

A localized string can have different values depending on the language in which the project is being build. There are two categories of localized strings: the strings included in the installation package's UI, common to every MSI file.

What is localized string key?

The key used to look up an entry in a strings file or strings dictionary file.


1 Answers

To answer how to test localized string on simulator?

I will assume that you have successfully added the Localizable.strings files for various languages you and you app want to target.

Step 1 - Goto target in the run destination.

enter image description here

Step 2 - Expand the menu to show options and then click on "Edit Scheme"

enter image description here

Step 3 - Click on "Run" and then select "Options". Choose the language you want to test for in the drop down available in the "Application Language"

enter image description here

Step 4 - CMD + R

That should be it!!

Please note that if you choose a language for which no Localization.string file was provided then it will show development language, which is more or less English.

Another but tedious way is to go to Simulator Settings > General > Language & Region > iPhone Language and choose the language. Since simulators can be buggy (like mine is) this process can be time consuming. Most of the time requiring rebooting of simulator (yet another time consuming task) for the changes to reflect.

Hope it helps!

Code and Prosper

Edit : Official Apple Link. If anyone is looking. Pointer -> "Testing Specific Languages and Regions"

like image 92
iOSer Avatar answered Oct 11 '22 01:10

iOSer