iOS Translate text given from API -


currently building weather iphone app. so, problem: using api wich gives response in english. want translate response german. somehow possible? have translated time , weekdays this:

- (id)init { if (self = [super init]) {     _hourlyformatter = [[nsdateformatter alloc] init];     _hourlyformatter.dateformat = @"h a";     _hourlyformatter.locale=[[nslocale alloc] initwithlocaleidentifier:@"de_de"] ;      _dailyformatter = [[nsdateformatter alloc] init];     _dailyformatter.dateformat = @"eeee";     _dailyformatter.locale=[[nslocale alloc] initwithlocaleidentifier:@"de_de"] ;   } return self; } 

ah , interface code based no interface files if needed (wich don't think never know, hu? :) )

so in case want translate condition. example clear or rain.

could maybe hall me that? api using openweathermap.org one.

if want app translate text automatically, system doesn't have support that, there apis can use that:

language translation api iphone

the other option translating text yourself, nslocalizedstring. in code have like:

newstring = nslocalizedstring(originalstring, nil); 

nslocalizedstring search translation string in .strings file.

for work, must create , fill .strings file. need select languages want project, , localize(translate) .strings file.

here nice tutorial on how (you need first parts): http://www.raywenderlich.com/2876/localization-tutorial-for-ios

after that, if device in german language, text appear in german too. , can add other languages if need it.


Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -