ios localization issue for library -
i trying develop custom control , plan publish using github drag&drop installation. support localized strings created mycontrol.bundle directory en.lproj , de.lproj folders inside. each folder contains mycontrol.strings language specific content.
in code defined macro this:
#define mylocalizedstring(key) \ nslocalizedstringfromtableinbundle(key, @"mycontrol", [nsbundle bundlewithpath:[[[nsbundle mainbundle] resourcepath] stringbyappendingpathcomponent:@"mycontrol.bundle"]], nil)
i use
mylocalizedstring(@"whatever_title");
in xcode edited schemes "application language" german , "application region" germany. when run in simulator works charm , displays german user interface.
when run on device, set german language , german region, shows me english user interface.
the following code
nsstring *language1 = [[[nsbundle mainbundle] preferredlocalizations] firstobject]; nsstring *language2 = [[[nsbundle mainbundle] preferredlocalizations] lastobject]; nsstring *language3 = [[nslocale preferredlanguages] objectatindex:0]; nslog(@"%@ %@ %@",language1, language2, language3);
gives me output:
en en de
what doing wrong?
thanks in advance!
**edit:
the following code
nsstring *language1 = [[[nsbundle mainbundle] localizations] firstobject]; nsstring *language2 = [[[nsbundle mainbundle] localizations] lastobject]; nsstring *language3 = [[nslocale preferredlanguages] objectatindex:0]; nslog(@"%@ %@ %@",language1, language2, language3);
gives me output:
base en de
Comments
Post a Comment