开发者

iphone internatiolization

I need to show a few texts fetched from web in my app. I need to ensure internatiolisation, but i dont want to keep all the resources locally. is it possible that when i开发者_运维技巧 hit server from china i get chinese response ? from japan i get japan response ? what would be the ideal solution ?


It's possible to (badly) convert an IP address to a country; search for "geoip". Debian's libgeoip probably uses GeoLite Country. Such databases are sometimes outdated or just wrong.

I think it's the wrong behaviour. I want apps to use the language that my phone is set to, not "the language of the country" — maybe I'm a tourist in China and I don't understand Chinese, or maybe I'm in Switzerland (should it be in German, French, or Latin?).

Assuming you'll use some localized resources, you can get the list of languages in preferred order with something like this:

NSArray * localizations = [[NSBundle mainBundle] preferredLocalizations];

Then pass the list to the server (or simply pass objectAtIndex:0 to the server).

Of course, relying on fetching resources from the server means you'll have to wait for them to load, and means your app doesn't work without an internet connection.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜