vallllll
vallllll

Reputation: 2761

strings and languages in xcode/iphone

Hi I have a problem with my strings and I have already checked this link and did what was told there but it doesn't work

So for the xib files I have a diferent version for each language and it works. but I have also a file named Localization.strings which for now only contains one string:

"password" = "passwords are not the same";

Then in my code I try to access the localized string:

NSString *tp=[[NSString alloc] initWithString:NSLocalizedString(@"password", nil)];

so tp is supposed to have the string "passwords are not the same" but no it returns "password". I have been wondering if it is the right way to write strings maybe you have to write the value itself on the left side??? Anyway I have two versions spanish and english and in both the same thing happens. I have deleted app from the iphone cleaned, changed language and reinstalled and nothing works.

thanks

Upvotes: 0

Views: 199

Answers (1)

PeyloW
PeyloW

Reputation: 36762

You problem is the naming of your strings-file. The default file that NSLocalizedString() do it's lookup in is Localizable.strings.

So rename Localization.strings to Localizable.string. You could also use a specific file for your lookup if you want too (if you for example split your localized strings into several strings-files). Using:

NSString *tp = NSLocalizedStringFromTable(@"password", @"Localization", nil);

Upvotes: 4

Related Questions