<legend id='swpCO'><style id='swpCO'><dir id='swpCO'><q id='swpCO'></q></dir></style></legend>

    <small id='swpCO'></small><noframes id='swpCO'>

  • <tfoot id='swpCO'></tfoot>
      <bdo id='swpCO'></bdo><ul id='swpCO'></ul>
    <i id='swpCO'><tr id='swpCO'><dt id='swpCO'><q id='swpCO'><span id='swpCO'><b id='swpCO'><form id='swpCO'><ins id='swpCO'></ins><ul id='swpCO'></ul><sub id='swpCO'></sub></form><legend id='swpCO'></legend><bdo id='swpCO'><pre id='swpCO'><center id='swpCO'></center></pre></bdo></b><th id='swpCO'></th></span></q></dt></tr></i><div id='swpCO'><tfoot id='swpCO'></tfoot><dl id='swpCO'><fieldset id='swpCO'></fieldset></dl></div>

      1. 您如何处理带有标记的文本翻译?

        时间:2023-08-01
                <tbody id='pPVBn'></tbody>
            1. <i id='pPVBn'><tr id='pPVBn'><dt id='pPVBn'><q id='pPVBn'><span id='pPVBn'><b id='pPVBn'><form id='pPVBn'><ins id='pPVBn'></ins><ul id='pPVBn'></ul><sub id='pPVBn'></sub></form><legend id='pPVBn'></legend><bdo id='pPVBn'><pre id='pPVBn'><center id='pPVBn'></center></pre></bdo></b><th id='pPVBn'></th></span></q></dt></tr></i><div id='pPVBn'><tfoot id='pPVBn'></tfoot><dl id='pPVBn'><fieldset id='pPVBn'></fieldset></dl></div>

              • <bdo id='pPVBn'></bdo><ul id='pPVBn'></ul>

                <small id='pPVBn'></small><noframes id='pPVBn'>

                <legend id='pPVBn'><style id='pPVBn'><dir id='pPVBn'><q id='pPVBn'></q></dir></style></legend><tfoot id='pPVBn'></tfoot>

                  本文介绍了您如何处理带有标记的文本翻译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在为我们的网络应用开发多语言支持.我们在 gettext 库.一切都出乎意料地简单,除了如何处理包含重要 HTML 标记的句子的问题.这是一个简单的例子:

                  I'm developing multi-language support for our web app. We're using Django's helpers around the gettext library. Everything has been surprisingly easy, except for the question of how to handle sentences that include significant HTML markup. Here's a simple example:

                  Please <a href="/login/">log in</a> to continue.
                  

                  以下是我能想到的方法:

                  Here are the approaches I can think of:

                  1. 更改链接以包含整个句子.不管在这种情况下改变是否是一个好主意,这个解决方案的问题在于,当两者在理想情况下独立时,UI 变得依赖于 i18n 的需求.

                  1. Change the link to include the whole sentence. Regardless of whether the change is a good idea in this case, the problem with this solution is that UI becomes dependent on the needs of i18n when the two are ideally independent.

                  将上面的整个字符串标记为翻译(包括格式).然后,翻译字符串也将直接包含 HTML.这样做的问题是更改 HTML 格式需要更改所有翻译.

                  Mark the whole string above for translation (formatting included). The translation strings would then also include the HTML directly. The problem with this is that changing the HTML formatting requires changing all the translation.

                  将多个翻译紧密耦合,然后使用字符串插值将它们组合起来.例如,短语请 %s 继续"和登录"可以分别标记为翻译,然后合并.登录"被本地化,然后包装在 HREF 中,然后插入到翻译的短语中,这使 %s 保持在翻译中以标记链接应该去哪里.这种方法使代码复杂化并破坏了翻译字符串的独立性.

                  Tightly couple multiple translations, then use string interpolation to combine them. For the example, the phrase "Please %s to continue" and "log in" could be marked separately for translation, then combined. The "log in" is localized, then wrapped in the HREF, then inserted into the translated phrase, which keeps the %s in translation to mark where the link should go. This approach complicates the code and breaks the independence of translation strings.

                  还有其他选择吗?其他人是如何解决这个问题的?

                  Are there any other options? How have others solved this problem?

                  推荐答案

                  解决方案 2 就是您想要的.将整个句子发送给他们,并嵌入 HTML 标记.

                  Solution 2 is what you want. Send them the whole sentence, with the HTML markup embedded.

                  原因:

                  1. 主要的翻译工具 Trados 可以防止翻译人员无意中损坏标记.
                  2. Trados 还可以自动翻译它以前见过的文本,即使标签的内容发生了变化(但标签的数量和它们在句子中的位置是一样的).最起码,译者会给你一个很好的折扣.
                  3. 样式是特定于语言环境的.在某些情况下,粗体在中文或日文中是不合适的,例如,斜体在东亚语言中不太常用.译者应该有保留或删除样式的自由.
                  4. 词序因语言而异.如果将上面的句子分割成片段,它可能适用于英语和法语,但在中文或日语中,当你连接时,单词顺序会不正确.因此,最好的做法是外化整个句子,而不是句子片段.

                  这篇关于您如何处理带有标记的文本翻译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:我可以从我的 Chrome 扩展程序中获取可用的语言环境翻译列表吗? 下一篇:Date.toLocaleString() 的 Chrome 时区选项

                  相关文章

                • <i id='sBK1I'><tr id='sBK1I'><dt id='sBK1I'><q id='sBK1I'><span id='sBK1I'><b id='sBK1I'><form id='sBK1I'><ins id='sBK1I'></ins><ul id='sBK1I'></ul><sub id='sBK1I'></sub></form><legend id='sBK1I'></legend><bdo id='sBK1I'><pre id='sBK1I'><center id='sBK1I'></center></pre></bdo></b><th id='sBK1I'></th></span></q></dt></tr></i><div id='sBK1I'><tfoot id='sBK1I'></tfoot><dl id='sBK1I'><fieldset id='sBK1I'></fieldset></dl></div>

                  <small id='sBK1I'></small><noframes id='sBK1I'>

                  <legend id='sBK1I'><style id='sBK1I'><dir id='sBK1I'><q id='sBK1I'></q></dir></style></legend>

                      <bdo id='sBK1I'></bdo><ul id='sBK1I'></ul>
                    1. <tfoot id='sBK1I'></tfoot>