找到你要的答案

Q:iOS App Localisation Best Practices And Placeholders

Q:iOS应用程序本地化的最佳实践和占位符

We're currently at the stage of looking at localising our app in to multiple languages now that the general concepts of the app have been decided. This is something I want to ensure is done correct from the start to lower the risk of headaches in the future.

The app targets iOS 7 and above, uses storyboards, and is written in Swift.

Storyboards

When working with a storyboard (or a xib), what's the best way to mark a UI element as "not to be translated"? For example, I have a placeholder string for a user's display name (Display Name), which will be replaced by a users display name at run time. This display name will not be localised, but neither should the string "Display Name". Is there a method of not having a UI element's value automatically put in to the strings file? If not, is going in to that file and manually removing strings I don't want localising a sustainable option?

Strings In Code

I'm using the Swift function NSLocalizedString with the key and comment parameters. Some places I've seen say to set the key to be a unique id based on the context (e.g., intro.login-button-text), while others seem to just put the full string in the default language (e.g., Login). I like the idea of the unique ids for the key, but would this not go against the idea of the "base" language?

Exporting

Xcode 6's "Export For Localization" option seems very useful for getting the correct format of file to be sent to translators. However, as mentioned previously, placeholder text does not need to be translated. Should these placeholders be removed from the exported xliff or the strings file prior to export?

我们目前在寻找定位我们的应用程序在多种语言的现在,该应用程序的一般概念已决定阶段。这是我想确保从一开始就做正确的,以降低未来头痛的风险。

应用目标的iOS 7以上,使用故事板,和写在斯威夫特。

故事板

使用故事板时(或xib),标志着一个UI元素的“不可译”的最好方法是什么?例如,我有一个用户的显示名称的占位符字符串(显示名称),它将在运行时由用户的显示名称替换。此显示名将不被本地化,但也不应该字符串“显示名称”。是否有一个方法,没有一个UI元素的值自动放在字符串文件?如果没有,去到那个文件,手动删除字符串,我不想要一个可持续的选择定位?

在编码的字符串

我使用的快捷功能nslocalizedstring与关键参数和评论。我见过说集是基于上下文的唯一ID关键的一些地方(如介绍。登录按钮文本),而其他人似乎只是把完整的字符串的默认语言(例如,登录)。我喜欢的独特的IDS的关键,但这不违背“基地”语言的想法?

出口

Xcode 6的“出口”本土化的选择似乎很有用的获得正确的文件格式来翻译。然而,如前所述,占位符文本不需要翻译。这些占位符从出口或去掉XLIFF文件之前出口?

answer1: 回答1:

Looking for the the same questions myself. Hope this will help you and others. Also I would recommend to have some kind of tool to organize the xliff/string files

Storyboards:

I've seen developers putting non translating texts in storyboard with extra parentheses. i.e. {Display name}.

By using this you can see by the translation itself if it needs to be translated or not. We use oneskyapp.com and can select to hide those translations and they will be hidden for each import of that key.

Strings in Code

By following this thread they suggest to use keywords. Best practice for key values in translation files

Exporting

I cannot find a way to have some translations automatically removed when exporting. Off course you can put the views which has dynamic fields in different XIB/storyboards and decide not to translate those.

Again a tool like onskyapp.com can help you with this.

Formats

As of context with the field is important and a translation can be different when it is followed by i.e. a users name I would go for "%1$@ is online!"

寻找同样的问题我自己。希望这能帮助你和其他人。我也会推荐给有某种工具来组织XLIFF /文件

故事板:

我见过开发商把非翻译文本与额外的括号的故事。即显示名称}。

通过使用这个你可以看到翻译本身,如果它需要翻译或不。我们用oneskyapp.com可以选择隐藏那些翻译,他们将被隐藏,每个进口的关键。

在编码的字符串

By following this thread they suggest to use keywords. Best practice for key values in translation files

出口

我找不到一个出口时自动删除一些翻译的方法。当然,你可以把意见已在不同领域和XIB /故事板动态决定不将这些。

又如onskyapp.com工具可以帮助你在这。

格式

在上下文中,字段是重要的,当它后面跟着一个用户名字时,翻译会是不同的,我会选择“% 1 $ @在线”!

ios  swift  localization