Questions tagged [i18next]

i18next is a full-featured i18n javascript library for translating your webapplication.

i18next is a full-featured i18n javascript library for translating your webapplication.

1430 questions
85
votes
13 answers

HTML tags in i18next translation

I'm using i18next to power i18n for my weblog. It works great on text-only content, but when I try to translate content that includes HTML markup, it is displaying the raw markup when I translate the text. As an example, here is a snippet of the…
user212218
54
votes
2 answers

i18next::pluralResolver: Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill

Please help me. Error - i18next::pluralResolver: Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling Code - import i18n from "i18next"; import…
sasigarn
  • 543
  • 1
  • 3
  • 5
54
votes
7 answers

React i18n break lines in JSON String

I'm working with i18next for react https://github.com/i18next/react-i18next. I'm struggling to break lines within the string in my JSON language file. This is what I already tried, which doesn't break a new line: line: "This is a line. \n This is…
Nocebo
  • 1,927
  • 3
  • 15
  • 26
51
votes
7 answers

react-i18next:: You will need to pass in an i18next instance by using initReactI18next

react-i18next:: You will need to pass in an i18next instance by using initReactI18next I recently added the package and got this error. I have followed all the steps as far as I know. I use Next.js with the next-i18next package which usually…
m2v
  • 513
  • 1
  • 4
  • 5
40
votes
2 answers

Get current language next-i18next

I am using NextJS with next-i18next. This is my home page: import {withTranslation} from '../config/next-i18next'; const Home = function Home() { return (
test
) }; Home.getInitialProps = async () => { return {namespacesRequired:…
gdfgdfg
  • 3,181
  • 7
  • 37
  • 83
37
votes
4 answers

react-i18next: interpolation of link in HTML tag in the middle of the text

I am using react, i18next and react-i18next. I would like to have some translatable text with HTML link in the middle of the text which is interpolated in react, something like this: This is my text with a beautiful link in…
Knut Holm
  • 3,988
  • 4
  • 32
  • 54
33
votes
5 answers

HTML tags in i18next translation files in React

I'm using i18next in a project and can't get around including html tags in translation files and having them properly rendered. An example of my .json translation file: "en": { "product": { "header": "Welcome, User!" …
Petr Gazarov
  • 3,602
  • 2
  • 20
  • 37
28
votes
6 answers

Using react-i18next within a class component

I am trying to translate my application using react-i18next. I know how to use it with simple const components, but not within a class. I'm working with the I18nextProvider. This is my App.js file. import React, { Component } from 'react'; import…
27
votes
6 answers

How to type check i18n dictionaries with TypeScript?

Is there a possibility to type check existing keys in react-i18next dictionaries? So that TS will warn you during compile time if key doesn't exist. Example. Suppose, we have this dictionary: { "footer": { "copyright": "Some copyrights" }, …
Green
  • 28,742
  • 61
  • 158
  • 247
27
votes
3 answers

How can I enable react-i18n translation file to be used in the unit tests done with react-testing-library and jest?

I am making unit tests with jest and react-testing-library for my frontend application which is done with React. My unit tests worked nicely before I added the internationalization with react-i18next -library. Now when I run the tests, it seems that…
27
votes
5 answers

How do I mock react-i18next and i18n.js in jest?

package.json "moduleNameMapper": { "i18next": "/__mocks__/i18nextMock.js" } i18n.js import i18n from 'i18next' import XHR from 'i18next-xhr-backend' // import Cache from 'i18next-localstorage-cache' import LanguageDetector from…
chovy
  • 72,281
  • 52
  • 227
  • 295
23
votes
6 answers

How to disable caching for i18next translation.json files?

I'm running a single page app on IIS and using i18next library for translations in my app. The problem is that sometimes when I add new keywords to my translation.json file and hit refresh, the browser still uses the old cached translation file and…
JZ555
  • 617
  • 2
  • 7
  • 16
22
votes
5 answers

React i18next and correct way of changing language

I am developing a multilanguage application using React, i18next and i18next-browser-languagedetector. I initialize i18next the following way: i18n .use(LanguageDetector) .init({ lng: localStorage.getItem(I18N_LANGUAGE) || "pt", …
pteixeira
  • 1,617
  • 3
  • 24
  • 40
21
votes
2 answers

How to use i18next? Problems with translations

I want to use a internationalization option at my jQuery Mobile and jQuery webside. I tried to generate an example with the documentation on http://i18next.com but it seems I failed. Does anybody has experiences with i18next? Here my…
Thomas
  • 345
  • 2
  • 6
  • 12
20
votes
4 answers

i18n support is not compatible with next export. (SSR - NextJS 10)

i18n support is not compatible with next export. NextJS dont run the deploy with i18n Im using nextJS 10, and the main reason that i choose next 10, is that i can do SSR and use the i18n. Internationalized Routing its a new next js 10 feature and…
Luck dev
  • 435
  • 2
  • 5
  • 13
1
2 3
95 96