【问题标题】:Handling Grammar / Spelling Issues in Translation Strings处理翻译字符串中的语法/拼写问题
【发布时间】:2011-05-15 04:43:24
【问题描述】:

我们目前正在实施一个 Zend 框架项目,需要将其翻译成 6 种不同的语言。我们已经有了一个非常复杂的翻译系统,它基于 Zend_Translate,它还处理翻译键中的变量。

我们的项目有一位新的土耳其语翻译,我们面临一个新问题:语法,尤其是土耳其语。我注意到这个问题可能在每个翻译系统和大多数语言中都很明显,所以我在这里发布了一个问题。

问题:关于如何处理翻译的任何想法,例如:

Key: I have a[n] {fruit} 
Variables: apple, banana
Result: I have an apple. I have a banana.
Key: Stimme für {user}[s] Einsendung
Variables: Paul, Markus
Result: Stimme für Pauls Einsendung,
Result: Stimme für Markus Einsendung

有人对此有解决方案或想法吗?我唯一的猜测是通过不使用出现这些问题的翻译来避免这种情况。 其他平台如何处理?

当然,翻译系统不知道将哪种类型的词放在哪种类型的句子中。它只做一些字符串替换...

PS:土耳其语更复杂:

For example, on a profile page, we have "Annie's Network". This should translate as "Annie'nin Aği".
If the first name ends in a vowel, the suffix will start with an n and look like "Annie'nin"
If the first name ends in a consonant, it will not have the first n, and look like "Kris'in"
If the last vowel is an a or ı, it will look like "Dan'ın"; or Seyma'nın"
If the last vowel is an o or u, it will look like "Davud'un"; or "Burcu'nun"
If the last vowel is an e or i, it will look like "Erin'in"; or "Efe'nin"
If the last vowel is an ö or ü, it will look like "Göz'ün'; or "Iminönü'nün"
If the last letter is a k (like the name "Basak"), it will look like "Basağın"; or "Eriğin"

【问题讨论】:

  • 为什么说相当复杂的翻译系统?我不明白,对不起。英语和德语的示例非常基本(没有偏角),您的系统没有管理这些?

标签: variables internationalization translation grammar spelling


【解决方案1】:

这实际上是一个非常困难的问题,因为即使是同一家族的语言,语法规则也不同。我认为你不能轻易为斯拉夫语言做任何事情......

但是,如果您想解决这个问题(因为这更具挑战性)并且您正在寻找创造性(交叉启发)方法来做到这一点,您可能需要研究一种叫做 ChoiceFormat 的东西(例如来自 @ 987654321@) 或者您可以查找GNU Gettext's solution for plural forms problem

【讨论】:

  • 感谢您的回答。我们目前拥有的翻译解决方案可以处理复数。但这不仅仅是复数形式……它似乎更复杂……
  • 我知道这不仅仅是关于复数,而且你真正想要的是一种叫做屈折的东西。我给了你一些其他语言问题的例子以及解决它们的方法。如果我要为 Inflection 实现解决方案,我可能会选择正则表达式、选择格式化程序和翻译器提供的元数据的组合。这是一个非常困难的问题,真的。
【解决方案2】:

ICU(上面提到的)有一个 SelectFormat http://site.icu-project.org/design/formatting/select 可能会有所帮助 - 它就像一种选择格式,但带有任意关键字。此外,它确实有一个 PluralFormat,它已经有许多语言的复数规则的规则。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-25
    相关资源
    最近更新 更多