如何使 iOS 应用名称可本地化? [英] How to make iOS app name localizable?
问题描述
我正在尝试找到最简单的方法来本地化我的应用程序.我正在使用 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屋!