在JSON字符串中反应i18n换行

在JSON字符串中反应i18n换行,第1张

在JSON字符串中反应i18n换行

您可以使用css

white-space: pre-line;
n
翻译文本中执行此 *** 作。

const root = document.getElementById('root');i18next.init({  lng: 'en',  resources: {    en: {      translation: {        "key": "Hello worldnThis sentence should appear on the second line"      }    }  }}, function(err, t) {  // initialized and ready to go!  root.innerHTML = i18next.t('key');});#root {  white-space: pre-line;}<script src="https://unpkg.com/i18next@15.0.9/dist/umd/i18next.min.js"></script><div id="root"></div>


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/4904197.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-12
下一篇2022-11-12

发表评论

登录后才能评论

评论列表(0条)

    保存