iOS wrong localization -
iOS wrong localization -
i have ios application localized in multiple languages. have localizable.strings files english, dutch , dutch (belgium). problem when dutch set device language , kingdom of belgium country, dutch strings used , not dutch-belgium strings.
i've added logging create sure right language set on device, , appears correct:
nslocale *locale = [nslocale currentlocale]; nsstring *language = [locale displaynameforkey:nslocaleidentifier value:[locale localeidentifier]]; nslog(@"language %@", language);
this prints out
2015-04-09 11:49:26.227 mytestapp[222:7459] language nederlands (belgiƫ)
but if seek string using nslocalizedstring dutch resource, not dutch kingdom of belgium one.
i've tested on iphone 5s running 8.1 , on several 7.1/8.1 simulators , can't work. interesting thing if forcefully set language dutch (belgium) in xcode under edit scheme -> application language, right language used.
it turns out problem xcode creates resource folders each language hyphen separating language , region, e.g. nl-be.proj. however, locale code uses underscore, e.g. nl_be, part never matched. appears xcode bug.
the solution alter locale includes hyphen discussed here http://stackoverflow.com/a/14357315/416214
ios localization
Comments
Post a Comment