Search code examples
ioslocalizationsettings.bundle

Localizing strings from the Settings.bundle using InAppSettingsKit


I am attempting to use InAppSettingsKit to manage my settings. This uses the Settings.bundle with a .plist file and the .strings files for each of the languages being translated.

I can confirm that the translation of my strings is working properly outside of my application, using the Setting application. But when I am in my application, the translation is not occurring.

I think it comes down to code like this, from the InAppSettingsKit class IASKSettingsReader, with a couple logging statements that I thought my be helpful:

- (NSString*)titleForStringId:(NSString*)stringId {
    NSLog(@"%@",[_bundle localizedStringForKey:stringId value:stringId table:self.localizationTable]);
    NSLog(@"%@",[_bundle localizedInfoDictionary]);
    return [_bundle localizedStringForKey:stringId value:stringId table:self.localizationTable];
}

If I understand correctly, this should be using a table with the name self.localizationTable as the source of the translation. This value is simply "Root". It's not a path to the Root.strings file in the selected language, so I am guessing that the method localizedStringForKey:value:table: must be using some global system reference that points to the correct path.

I have confirmed that the strings file name is "Root.strings" all around, with a capital R, including in the Root.plist file.

[_bundle localizedInfoDictionary] returns (null); It is doing this for two language settings of English and French.

I'm not sure how to debug this. Thanks for any help you can give.


Solution

  • I'm using InAppSettingsKit with localized text with no problems. Two things I can think of that you could check: are your Root.strings files located in the correct subdirectories of Settings.bundle (en.lproj and fr.lproj for English and French?

    Is there a "Strings Filename" entry in your Root.plist? It should simply contain a string with value "Root"