Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Localizing nested Info.plist keys

I'm trying to localize a key in the InfoPlist.strings files which consists of a nested dictionary, like so:

baseKey = {
    secondDict = {
        "key" = "value";
    };
};

Is there any way I can access the inner key directly from the InfoPlist.strings file?

"baseKey.secondDict.key" = "newValue";

doesn't seem to work... Any ideas? I know I can replicate the dictionary structure in the strings file, but it contains some other information that I would prefer not to have in there.

like image 240
Harry Lachenmayer Avatar asked Nov 12 '22 23:11

Harry Lachenmayer


1 Answers

Apparently it works like this:

Replace "value" with some localization identifier newvalue_i18n_key.

Then, in InfoPlist.strings for each language, do this:

newvalue_i18n_key = "value";

This is more similar to how NSLocalizedString works. To my reading, this is not what Apple says in the official documentation regarding localizing plist files, but it is what Apple does in some sample code.

This question comes up with the same answer.

like image 98
divergio Avatar answered Dec 09 '22 23:12

divergio