프로젝트에서 i18next을 사용하고 있으며 번역 파일의 html 태그를 포함하여 제대로 렌더링 할 수 없습니다.i18next에있는 HTML 태그는 다음과 같은 언어로 번역되었습니다.
내 .json
번역 파일의 예 :
"en": {
"product": {
"header": "Welcome, <strong>User!</strong>"
}
}
거기에 excellent answer to this question이지만, JQuery와 관련. 나는 내 프로젝트가 여기에 반작용하고, 내가 가지고있는 설정을 JQuery와되어 사용하지 않는 :
구성 요소에서import i18next from 'i18next';
import en from 'locales/en';
i18next.
init({
lng: 'en',
fallbackLng: false,
resources: en,
debug: false,
interpolation: {
escapeValue: false
}
});
export default i18next.t.bind(i18next);
내가 가진 :
import t from 'i18n';
t('product.header')
HTML을 내가 원하는 :
Welcome, <strong>User!</strong>
Html 알아 듣겠습니다 :
Welcome, <strong>User!</strong>
이상 ks
v4.4.0에서는 번역에 반응 요소를 포함시키기 쉽게하기 위해 새로운 구성 요소를 추가했습니다. https://react.i18next.com/components/trans-component.html – jamuhl