1
使用polyglot.js,我想知道如何翻譯文本中的標記/組件?考慮下面的文本示例:使用polyglot.js翻譯帶有標記的文本
with the <strong>free</strong> features you can <Link to="/pricing">achieve</Link> the following things
我可以將該句子分解爲多個鍵,但翻譯時沒有意義。什麼是好方法?
使用polyglot.js,我想知道如何翻譯文本中的標記/組件?考慮下面的文本示例:使用polyglot.js翻譯帶有標記的文本
with the <strong>free</strong> features you can <Link to="/pricing">achieve</Link> the following things
我可以將該句子分解爲多個鍵,但翻譯時沒有意義。什麼是好方法?
同意分裂它是一個壞主意......讓翻譯比需要更大的痛苦。
看你的標籤你使用的反應和node.js中計 - >反應,你可以採取從多語種翻譯的內容,並使用dangerouslysetinnerhtml https://facebook.github.io/react/docs/dom-elements.html#dangerouslysetinnerhtml
這是什麼工作 - 但老實說,我會看看i18next(擾流我是該框架的維護者)。隨着反應-i18next你能做到這些標記翻譯要好很多:https://github.com/i18next/react-i18next/
使用反式組件:
<Trans i18nKey="userMessagesUnread" count={count}>
Hello <strong title={t('nameTitle')}>{{name}}</strong>, you have {{count}} unread message. <Link to="/msgs">Go to messages</Link>.
</Trans>
http://i18next.com - >上的Node.js運行太 - >自帶中間件的快遞,koa https://www.i18next.com/supported-frameworks.html – jamuhl
謝謝,我想這是i18next over polyglot的論據然後 – Stuck