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.

805 questions
60
votes
8 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
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
3 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,386
  • 2
  • 10
  • 25
17
votes
2 answers

How to translate routes with NextJS and next-i18next?

I'm building a multiple language website with next.JS and the package next-i18next. It's going well, except one thing that I'm not sure what's the best approach. I want that my static routes will be translated too (not only the page content), for…
Alexandre Paiva
  • 407
  • 4
  • 14
17
votes
3 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…
knuhol
  • 3,636
  • 4
  • 27
  • 53
16
votes
3 answers

Translate custom attributes with i18next (placeholder, value)

I am investigating what is possible with i18next localization library. Right now I have the following code (full Fiddle is here): HTML
Salvador Dali
  • 182,715
  • 129
  • 638
  • 708
15
votes
2 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…
15
votes
4 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…
15
votes
4 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,487
  • 3
  • 24
  • 35
14
votes
3 answers

i18next json dot in key or label

JS: i18n.t("SOME TEXT TO BE TRANSLATED.") JSON: "SOME TEXT TO BE TRANSLATED.": "Een stukje tekst om te vertalen" i18n.t("SOME TEXT TO BE TRANSLATED.") gives me "SOME TEXT TO BE TRANSLATED.". If I remove the "." (dot) from the label and the function…
Sven Cornelis
  • 301
  • 3
  • 9
14
votes
1 answer

i18next is not loading the translation file

I am working on some Backbone based project where i am using i18next for locales. Following is my app.js code: /* This file is used to initialize your application. */ require(['i18n','application','handlebars_Helpers'], function(i18n,…
Ashwin Hegde
  • 1,675
  • 4
  • 19
  • 45
13
votes
3 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
  • 59,357
  • 43
  • 187
  • 234
13
votes
5 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
  • 357
  • 1
  • 5
  • 13
12
votes
2 answers

What are the options for making a simple static website multilingual?

I'm setting up a static website which I want to display in two languages. I can't find a comprehensive overview of the different options (e.g. server-side loading vs front-end loading vs using different folders. What are the advantages of each…
11
votes
2 answers

How to switch languages with the i18next plugin?

I am using Backbone.js in my application and the i18next plugin for my language switch function on my application. When I pass a value to the lng option in the init function call, then it translates my page correctly. Now I want to do this…
harsh
  • 125
  • 1
  • 1
  • 8
1
2 3
53 54