如何强制应用程序更改iOS / Objective-C中的语言? [英] How to force an app to change language in iOS/Objective-C?

查看:146
本文介绍了如何强制应用程序更改iOS / Objective-C中的语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的make app更改语言就像这个应用程序

I'm having a problem with make app change language immediately like this app.

我发现了很多类似的问题,比如 this this

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆