i18next html 转义 - 服务器端生成的电子邮件需要

apa*_*ret 2 javascript email translation i18next

我使用 i18next 翻译电子邮件模板。它们包含文本需要的按钮, 以防止智能手机电子邮件阅读器上的不良渲染。为了防止智能手机电子邮件阅读器将按钮分成两部分,我确实需要有不间断的空格。

问题是,i18next 转义了 html。

My button我没有My button进入按钮,而是进入了按钮。

这是一个简化版本(伪代码),说明了我想要实现的目标:

BTN_ACTION = 'My button';

i18n.init(options, function (t) {
    t('BTN_ACTION')
};
Run Code Online (Sandbox Code Playgroud)

玉模板如下所示:

a#btn-create-account(href='url')=t('BTN_ACTION')
Run Code Online (Sandbox Code Playgroud)

小智 7

直接在源代码或其代码点中使用 Unicode 字符,如My\u00A0button.