Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSLocalizedString is it really working?

I misunderstand NSLocalizedString.

I have a project with French and English .strings files. In project target - Localizations I have 6 files in French and English.

In english.strings file:

"hello" = "world";

In french.strings file:

"hello" = "salut";

When I write a simple line of code to change label text:

exerciseDescription.text = NSLocalizedString(@"hello", @"no comment");

Output is: hello

I changed in iOS simulator : settings - general - international - language - French/English - Done

And output is again: hello

I thought it should be world or salut...


1 Answers

You're using it in correct way but not added properly,

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.

like image 51
Hemang Avatar answered Dec 06 '25 16:12

Hemang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!