如何强制应用程序更改iOS / Objective-C中的语言? [英] How to force an app to change language in iOS/Objective-C?
问题描述
我的make app更改语言就像这个应用程序。
I'm having a problem with make app change language immediately like this app.
I've found a lot of similar question like this and this.
但不幸的是,相关答案对这些问题不适合我。当我点击一个单元格时,我需要立即更改我的应用程序语言。
But, unfortunately, the related answers to these question don't work for me. I need my app change language immediately when I tap on an cell.
任何想法?提前感谢。
推荐答案
我认为这个将解决您的问题。
I think that this will solve your problem.
我有相同问题1个月前。
你可以关注这个教程。
例子:
在你的 .strings
文件中你放了翻译: code>hello=HOLA MUNDO;
In your .strings
file you put translation: "hello" = "HOLA MUNDO";
#import "LocalizationSystem.h"
LocalizationSetLanguage(@"Spanish");
CCLabel* label = [CCLabel labelWithString:AMLocalizedString(@"hello",@"Hello World") fontName:@"Marker Felt" fontSize:32];
编辑:这是用户在评论中提供的其他信息:
如果您要翻译更改语言选项的整个视图,我建议您制作每次更改语言时都会调用的方法:
EDIT: This is additional information as user asks in comment:
If you want to translate whole view where your language option is changed, I propose you to make method that will be called everytime you change language:
-(void)translateOnChoose {
self.label.text = AMLocalizedString(@"hello",@"Hello World");
}
这篇关于如何强制应用程序更改iOS / Objective-C中的语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!