带有HTML标记的20n? [英] l20n with HTML markup?

查看:74
本文介绍了带有HTML标记的20n?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想创建类似这样的东西,我将如何使用l20n:

How would I use l20n if I wanted to create something like this:

About <strong>Firefox</strong>

我想整体翻译该短语,但我也想要标记.我不想这样做:

I want to translate the phrase as a whole but I also want the markup. I don't want to have to do this:

<aboutBrowser "About {{ browserBrandShortName }}">
<aboutBrowserStrong "About &lt;strong&gt;{{ browserBrandShortName }}&lt;/strong&gt;">

...因为翻译本身已被复制.

...as the translation itself is now duplicated.

我知道这可能不在20n的范围内,但这在现实世界中可能是足够普遍的情况.有某种确定的方法可以解决这个问题吗?

I understand that this might not be in the scope of l20n, but it is probably a common enough case in the real world. Is there some kind of established way to go about this?

推荐答案

有时候,翻译是最好的.冗余在本地化方面很不错:它可以减少对翻译成其他语言的假设. L20n的核心原则之一是只有本地化者才能知道他们的真正需求.

Sometimes duplicating the translation is the best thing you can do. Redundancy is good in localization: it allows to make fewer assumptions about translations into other languages. One of the core principles of L20n is that only the localizer will know what they really need.

您提出的解决方案实际上是非常好的.您试图用<strong>表达的重点很有可能会对某些我们可能不了解的语言产生未知的影响.例如,某些语言可能会使用declensions或后置位置来表示关于某事",在这种情况下,您-开发人员-不应对<strong>元素的确切位置做出太多假设.整个翻译可能是一个由<strong>包围的单词.

The solution that you proposed is actually quite good. It's entirely possible that the emphasis that you're trying to express with <strong> will have some unknown implications in some language that we might not be aware of. For instance, some languages might use declensions or postpositions to mean "about something", in which case you—as a developer—shouldn't make too many assumptions about the exact position of the <strong> element. It might be that the entire translation will be a single word surrounded by <strong>.

再次使用L20n的多行字符串文字格式化您的代码:

Here's your code again, formatted using L20n's multiline string literals:

<aboutBrowser "About {{ browserBrandShortName }}">
<aboutBrowserEmphasized """
  About <strong>{{ browserBrandShortName }}</strong>
""">

请注意,要使此功能按预期工作,您需要使用data-l10n-id=aboutBrowserEmphasized向DOM节点添加data-l10n-overlay属性.否则,<>将被转义.

Note that for this to work as expected, you'll need to add a data-l10n-overlay attribute to the DOM node with data-l10n-id=aboutBrowserEmphasized. Otherwise, < and > will be escaped.

让我迅速离题并提出错误859035 -不要将相同的未知"实体用于Size&从Firefox OS安装WebApp时作者.讲英语的开发人员认为,他们可以使用未知"形容词在安装对话框中同时限定大小和作者.但是,在某些语言中,例如法语或波兰语,形容词必须在性别和复数形式上与宾语相符.因此,即使使用英语,我们也只能有一个字符串:

Let me digress quickly and bring up Bug 859035 — Do not use the same "unknown" entity for Size & Author when installing a WebApp from Firefox OS. The English-speaking developer assumed the they can use the "unknown" adjective to qualify both the size and the author in the installation dialog. However, in certain languages, like French or Polish, the adjective must be accorded with the object in terms of gender and plurals. So even though in English we can only have one string:

<unknown "Unknown">

…其他语言可能针对它们所使用的每个上下文都需要两个单独的字符串.在法语中,您会说"auteur inconnu"(未知作者,男性),但会说"tail inconnue"(未知大小,女性) :

…other languages might require two separate strings for each of the contexts they're used in. In French, you'd say "auteur inconnu" (unknown author, masculine) but "taille inconnue" (unknown size, feminine):

<unknownSize "inconnue">
<unknownAuthor "inconnu">

在英语中,这意味着一些冗余:

In English, this means some redundancy:

<unknownSize "Unknown">
<unknownAuthor "Unknown">

…但是没关系,因为最终提高了本地化的质量.通常最好在各处使用唯一的字符串,并谨慎地重用.理想情况下,您将允许对所有字符串进行不同的翻译.如果考虑使用威尔士语之类的语言,即使是简单,通用的是"和否"也可能很棘手:

…but that's OK, because in the end the quality of localization is improved. It is generally a good practice to use unique strings everywhere and reuse sparingly. Ideally, you'd allow different translations for all strings. Even something as simple and common as "Yes" and "No" can be tricky if you consider languages like Welsh:

威尔士每次都用一个词来回答是"和没有".使用的单词取决于问题的形式.通常,您必须使用问题中使用的动词的相关形式进行回答,或者在问题中动词不是您使用"ie"/"nage"的第一个元素的问题中.

Welsh doesn't have a single word to use every time for yes and no questions. The word used depends on the form of the question. You must generally answer using the relevant form of the verb used in the question, or in questions where the verb is not the first element you use either 'ie' / 'nage'.

这篇关于带有HTML标记的20n?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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