本地化基于 xib 的现代 Mac 应用程序 [英] Localizing a modern xib-based Mac application

查看:21
本文介绍了本地化基于 xib 的现代 Mac 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ours 是由志愿者本地化的开源 Mac 应用程序.这些志愿者将在软件的特殊本地化版本(带有未剥离的 nib)上完成他们的工作,然后将更改发送给我们以集成到原始 xib 和字符串文件中.

Ours is an open-source Mac application localized by volunteers. These volunteers will do their work on special localization builds of the software (with unstripped nibs), then send us the changes to integrate into the original xib and strings files.

问题在于,虽然有 一种方法集成字符串更改而不消除以前的大小更改,我看不到集成新字符串和大小更改的方法(就像我们添加或替换视图时一样).

The problem is that, while there is a way to integrate string changes without blowing away previous size changes, I can't see a way to integrate new string and size changes (as when we add or replace views).

我能看到的唯一方法是让本地化人员直接使用原始 xib 并将差异发送给我们.这意味着他们必须下载整个源代码,而不仅仅是发布的可本地化版本,在 Xcode 和 IB 中工作,或者自己运行 diff 命令(每个 xib)或者安装和使用 Mercurial.

The only way to do both that I can see is for localizers to work directly with the original xibs and send us diffs. That means they have to download the entire source code, not just a localizable version of the release, work in Xcode as well as IB, and either run the diff command themselves (per xib) or install and use Mercurial.

对于基于 xib 的应用程序有更好的方法吗?

Is there any better way for a xib-based application?

推荐答案

更新 2014 年 1 月:Apple 的自动布局"代码与他们的基本"本地化内容相结合,吸收了我的大部分想法并对其进行了改进.我建议不要使用我在这个答案中谈到的旧工具.但是,同样,我是对的!

UPDATE January 2014: Apple’s ‘autolayout’ code combined with their ‘Base’ localization stuff took most my ideas and improved on them. I recommend against using my old tools that I talk about in this answer. But, also, man was I right!

我强烈强烈建议不要在本地化中更改框架.我知道这与 Apple 的建议背道而驰,但是允许帧更改存在很多问题 - 你最终会遇到十亿个边缘情况.

I strongly strongly STRONGLY recommend against frame changes in localizations. I know this runs counter to Apple's advice, but there are SO MANY problems with allowing frame changes - you end up with a billion edge cases.

假设您的应用中有 10 个 XIB,并且您支持 12 种语言.现在,您可以支持 120 种不同的布局.你就是不能这样做.

Imagine you have 10 XIBs in your app, and you support 12 languages. You've got 120 different layouts to support, now. You just can't do this.

更改字符串,将视图留在原处.如果需要,可以在所有语言中让它们变得更大.听起来这不应该工作,但确实如此.(我的应用程序以这种方式本地化了大约 10 种语言,因此获得了三项 Apple 设计奖.)

Change the strings, leave the views where they are. Make 'em bigger in ALL languages, if you need to. It sounds like this shouldn't work but it does. (I won three Apple Design Awards with an app that's localized in 10 or so languages this way.)

具体说明:

  • 对于单选框和复选框,只要让它们向右延伸很远,超过最后一个英文字符即可.这也为不精确的鼠标提供了一个不错的大着陆区.

  • For radio and checkboxes, just let them extend far to the right, beyond the last English character. That also provides a nice big landing area for imprecise mousers.

对于按钮,无论如何它们都应该是宽的,因为将文本挤在按钮中间看起来不太好.

For buttons, they should be wide anyhow, because it never looks good to have text cramped in the middle of the buttons.

对于 tableview 列上的标题,如果需要,您应该在加载它们时自动调整大小.

For titles on tableview columns, you should autosize when you load 'em up, if needed.

对于解释性文字,你应该在右边留出一些额外的空间,也许还有一行.它只是让英文版的 XIB 看起来不那么混乱.当然,德国人会看到更严格的 XIB,但是,嘿,他们是德国人——他们可能已经习惯了.甚至可能有一个德语单词.Deutscheninterfakkenclutterlongen."

For explanatory text, you should have some extra space to the right, and maybe an extra line. It just makes the English version of the XIB seem less cluttered. Sure, the Germans are going to see a slightly tighter XIB, but, hey, they're Germans -- they're probably used to that. There's probably even a German word for it. "Deutscheninterfakkenclutterlongen."

如果文本字段居中,则只需在两侧添加相等的空间.没有理由不这样做.

If a text field is centered, just add equal space on both sides. There's no reason not to.

我已将此与脚本结合起来,这些脚本从我的 XIB 中提取所有字符串并将它们放入 .strings 文件中,然后在运行时动态地将字符串放回原处,因此任何人都可以在没有任何特殊工具的情况下本地化我的应用程序.只需放入一堆 .strings 文件并运行它!

I've combined this with scripts that suck all the strings out of my XIBs and put them in .strings files, and then dynamically put the strings back at run-time, so anyone can localize my app without any special tools. Just drop in a bunch of .strings files and run it!

包含完整来源的博文:[Lost in Translations]¹.

Blog post including full source: [Lost in Translations]¹.

这篇关于本地化基于 xib 的现代 Mac 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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