-3

I have

NSString *str=@"some unknown value coming from server";
NSString *localizedVersion1 = NSLocalizedString(str, nil);
NSLog(@"localizedVersion1 %@",localizedVersion1);

Getting:

localizedVersion1 some unknown value coming from server .

It's not changing even when I am changing the device language.

  • Have you translated the string to other languages? Are those localized strings files being included in the app? – rmaddy May 04 '16 at 17:23
  • I have checked it's working fine in google translator and also the value of str is unknown .Please help me to get out this situation. – Tapash Mollick May 04 '16 at 17:37
  • What does this have to do with Google translator? You are talking about localizing an iOS app. You need to create localized copies of your strings file. Did you do that? Sounds like you need to read the [Internationalization and Localization Guide](https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/Introduction/Introduction.html#//apple_ref/doc/uid/10000171i). – rmaddy May 04 '16 at 17:40
  • when I am not aware of the string value which is coming from server then how would i add that value to localized copies. – Tapash Mollick May 04 '16 at 17:56
  • anyone please help me. – Tapash Mollick May 04 '16 at 18:19
  • Did you read the entire document I linked? – rmaddy May 04 '16 at 18:20

1 Answers1

2

You have misunderstood the purpose of NSLocalizedString, it is not a translation service but a lookup one. With this mechanism an app can contain multiple sets of (UI) strings which are selected based on the current language setting. All the strings must exist in advance.

You mention using Google Translate on the web. If you need a translation service then you can use the Google Translate API in your app to provide this. There are other translation services available - just google for them.

HTH

CRD
  • 52,522
  • 5
  • 70
  • 86