处理翻译字符串中的语法/拼写问题

发布于 2024-10-04 09:23:13 字数 1310 浏览 7 评论 0原文

我们目前正在实施一个 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"

We are currently implementing a Zend Framework Project, that needs to be translated in 6 different languages. We already have a pretty sophisticated translation system, based on Zend_Translate, which also handles variables in translation keys.

Our project has a new Turkish translator, and we are facing a new issue: Grammar, especially Turkish one. I noticed that this problem might be evident in every translation system and in most languages, so I posted a question here.

Question: Any ideas how to handle translations like:

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

Anybody has a solution or idea for this? My only guess would be to avoid this by not using translations where these issues occur.
How do other platforms handle this?

Of course the translation system has no idea which type of word it is placing where in which type of Sentence. It only does some string replacements...

PS: Turkish is even more complicated:

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"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

墨离汐 2024-10-11 09:23:13

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

但是,如果你想解决这个问题(因为这是额外的挑战)并且你正在寻找创造性(交叉启发)的方法来做到这一点,你可能想研究一下名为 ChoiceFormat 的东西(例如来自 ICU 项目 的内容)或者你可以查找 GNU Gettext 针对复数形式问题的解决方案< /a>.

It is actually very hard problem, as grammar rules are different even among languages from the same family. I don't think you could easily do anything for let's say Slavic languages...

However, if you want to solve this problem (because this is extra challenging) and you are looking for creative (cross inspiring) ways to do that, you might want to look into something called ChoiceFormat (example would be one from ICU Project) or you can look up GNU Gettext's solution for plural forms problem.

给不了的爱 2024-10-11 09:23:13

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

ICU (mentioned above) has a SelectFormat http://site.icu-project.org/design/formatting/select that may be of help- it's like a choice format but with arbitrary keywords. Also, it does have a PluralFormat which already has rules for many language's plural rules.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文