如何使iOS应用程序名称可本地化? [英] How to make iOS app name localizable?

查看:200
本文介绍了如何使iOS应用程序名称可本地化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找到本地化我的应用的最简单方法。我正在使用sqlite,所以我基本上只需要切换我的数据库名称。问题是应用程序名称 - 它是否可以从代码本地化,或者我必须为x语言制作x应用程序,因此任何人都将使用他/她的母语应用程序名称?后者似乎已经拒绝了我的应用......任何人?

I'm trying to find the easiest way to localize my app. I'm using sqlite, so I need basically only to switch my database name. Problem is the app name - can it be localized from code or I have to make x apps for x languages, so anyone will have app name in his/hers native language? The latter one seems like already rejected app to me... anyone?

推荐答案

我假设您的意思是出现的Bundle Display Name在设备的主屏幕上:
你应该创建一个名为 InfoPlist.strings 的本地化文件,类似于 Localizable.strings 用于常用文本片段的文件。

I assume you mean the Bundle Display Name that appears on the device's home screen: You should create a localized file called InfoPlist.strings similar to the Localizable.strings file that you use for the usual text snippets.

InfoPlist.strings 中,您可以本地化不同的文本片段。来自Info.plist的密钥。要本地化应用名称,请添加:

In the InfoPlist.strings you can localize the different keys from your Info.plist. To localize the app name add:

"CFBundleDisplayName" = "My localized app name";

要本地化文件:只需在Xcode中创建一个新的字符串文件。然后显示正确的Xcode窗格并通过此处显示的菜单添加本地化:

To localize a file: Simply create a new strings file in Xcode. Then reveal the right Xcode pane and add localizations via the menu shown here:

使用此技术,您可以本地化您喜欢的任何文件。只需在捆绑包中添加正确的版本即可。如果您然后使用 [[NSBundle mainBundle] pathFor ... ,您将自动获得正确本地化的路径。我们为sqlites,字符串和有时甚至图像执行此操作。

Using this technique you can localize any file you like. Simply add the correct version to your bundle. If you then use [[NSBundle mainBundle] pathFor... you will automatically get the path to the correct localization. We do this for sqlites, strings and sometime even images.

这篇关于如何使iOS应用程序名称可本地化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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