1

In my framework app, I have some localization files added and have a method to get localised strings as follow

-(NSString *)getCurrentLocale{
    return NSLocalizedString(@"mykey", nil);
}

and I have installed this pod into one demo app, and trying to get the locale but it always returns the key, (it returns 'mykey')

I have double checked the format and name (Localizable.strings) within the string files all files has proper format

but I do have locale strings as values in my Localizable.strings

 ex:  "mykey" = "ar_SA"; 

any Idea where I am going wrong?

Ravi Kiran
  • 219
  • 3
  • 14

1 Answers1

2

Usually, this happens when you don't have the Localizable.strings file in the appropriate language folder (e.g. de.lproj). Also, ensure you haven't put your Localizable.strings file in the Base.lproj folder, as the same problem will occur.

To summarize, make sure your project Localizations have their Localizable.strings files in their respective language folders to provide the correct translations.

Finally, if the above are true (and this may be obvious), the device must have its locale set to actually pull strings from a given language.

Reference: Internationalization and Localization Guide

theeagle
  • 141
  • 1
  • 9