如何在模拟器上测试本地化字符串? [英] How to test localized string on simulator?

查看:75
本文介绍了如何在模拟器上测试本地化字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用NSLocalizedString();我的本地化字符串的功能.即使我在模拟器设置中更改了首选语言,我的字符串仍然会以英语显示.

I am using NSLocalizedString(); function for my localized strings. Even though i change my preferred language in simulator settings my string still get shown up in English.

我们可以测试NSLocalizedString();吗?从模拟器?如果可以,怎么办?

Can we test the NSLocalizedString(); from simulator? if so how?

请问有人可以指导我吗?

Can any one guide me through this please?

- 问候

U'suf

推荐答案

要回答如何在模拟器上测试本地化字符串?

To answer how to test localized string on simulator?

我将假定您已成功为您和应用想要定位的多种语言添加了 Localizable.strings 文件.

I will assume that you have successfully added the Localizable.strings files for various languages you and you app want to target.

第1步-在运行目标中转到目标.

Step 1 - Goto target in the run destination.

第2步-展开菜单以显示选项,然后单击编辑方案"

Step 2 - Expand the menu to show options and then click on "Edit Scheme"

第3步-单击运行" ,然后选择选项" .在应用程序语言"

Step 3 - Click on "Run" and then select "Options". Choose the language you want to test for in the drop down available in the "Application Language"

第4步- CMD + R

应该就是这样!

请注意,如果您选择的语言没有提供Localization.string文件,那么它将显示开发语言,或多或少是英语.

Please note that if you choose a language for which no Localization.string file was provided then it will show development language, which is more or less English.

另一种乏味的方法是进入模拟器设置">常规">语言和功能".区域> iPhone语言,然后选择语言.由于模拟器可能有故障(就像我的一样),因此此过程可能很耗时.在大多数情况下,需要重新启动模拟器(这是另一个耗时的任务),以反映更改.

Another but tedious way is to go to Simulator Settings > General > Language & Region > iPhone Language and choose the language. Since simulators can be buggy (like mine is) this process can be time consuming. Most of the time requiring rebooting of simulator (yet another time consuming task) for the changes to reflect.

希望有帮助!

代码与繁荣

官方Apple链接.如果有人在找.指针-> 测试特定的语言和地区"

Edit : Official Apple Link. If anyone is looking. Pointer -> "Testing Specific Languages and Regions"

这篇关于如何在模拟器上测试本地化字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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