xcode 如何本地化不同语言的 iphone 应用程序?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8118425/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 22:25:20  来源:igfitidea点击:

How to localize an iphone app for different languages?

iphoneobjective-cxcodelocalization

提问by Valli

Can anyone explain me how to localize an iPhone app ? I am getting confused with the XCode localization concept.

谁能解释一下如何本地化 iPhone 应用程序?我对 XCode 本地化概念感到困惑。

回答by Oliver

First you may define in your project settings the languages you want to manage. That's not a needed work but it's great to start there.

首先,您可以在项目设置中定义要管理的语言。这不是必需的工作,但从那里开始很棒。

Then for each of your XIB you want to localize, click on it, go to the property panel and add wanted languages. The unique XIB file will be then dispatched into many files, one for each language. Then just adapt each one as wanted.

然后对于您想要本地化的每个 XIB,单击它,转到属性面板并添加所需的语言。然后将唯一的 XIB 文件分派到许多文件中,每种语言一个。然后根据需要调整每一个。

It's the same way of doing for images, sounds, or any resource.

对于图像、声音或任何资源,也是如此。

For the Strings you may have writen in your code, add a "Localizable.strings" file into your project and add into it some keys like :

对于您可能在代码中编写的字符串,将“Localizable.strings”文件添加到您的项目中,并在其中添加一些键,例如:

"Goodbye_Code" = "Adiós"

and in your code, where you had writen @"Goodbye", replace by :

并在您编写@"Goodbye" 的代码中,替换为:

NSLocalizedString(@"Goodbye_Code", @"Some description : I'm saying goodye to the user that is leaving the app");

In the end, remember that your app may have a default language setting. If a localization is not created, the one that correspond to that default language will be used in place.

最后,请记住您的应用程序可能具有默认语言设置。如果未创建本地化,则将使用与该默认语言对应的本地化。

You can check those links for further information :

您可以查看这些链接以获取更多信息:

http://www.raywenderlich.com/2876/how-to-localize-an-iphone-app-tutorial

http://www.raywenderlich.com/2876/how-to-localize-an-iphone-app-tutorial

http://www.icanlocalize.com/site/tutorials/iphone-applications-localization-guide/

http://www.icanlocalize.com/site/tutorials/iphone-applications-localization-guide/