i18next

React i18n break lines in JSON String

不问归期 提交于 2020-07-05 06:52:38
问题 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 another line. \n Yet another line" , line: ("This is a line."+ <br/> + "This is another line. \n Yet another line") , line: ('This is a line. <br/> This is another line. \n Yet another line') , I obviously try to make a new line after each sentence.

React i18next and correct way of changing language

霸气de小男生 提交于 2020-06-08 03:30:52
问题 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", fallbackLng: "pt", resources: { en: stringsEn, pt: stringsPt }, detection: { order: ["localStorage", "navigator"], lookupQuerystring: "lng", lookupLocalStorage: I18N_LANGUAGE, caches: ["localStorage"] } }); export default i18n; And I have implemented a language

React i18next and correct way of changing language

心不动则不痛 提交于 2020-06-08 03:29:47
问题 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", fallbackLng: "pt", resources: { en: stringsEn, pt: stringsPt }, detection: { order: ["localStorage", "navigator"], lookupQuerystring: "lng", lookupLocalStorage: I18N_LANGUAGE, caches: ["localStorage"] } }); export default i18n; And I have implemented a language

Update in real time tooltip with react-leaflet when changing language with i18n

假如想象 提交于 2020-06-01 05:43:06
问题 I am currently displaying a Map, thanks to react-leaflet, with a GeoJSON Component. I'm also displaying some tooltips on hover over some countries and cities(for example, when I hover France, a tooltip display "France"). I'm also using i18n for internationalization. The internationalization works fine for the country tooltips, they are updated in real time. I have a function updateDisplay , that switch between a GeoJson component for the countries, or a list of Marker for the cities, on zoom

How do I localize routes with next.js and next-i18next?

江枫思渺然 提交于 2020-01-24 21:09:17
问题 I need to change the name of the route when I change the language. For example, I have a route /en/career but when I change to Czech language, I need a route /cs/kariera . Basically I need the URLs to be localized. Right now, when I'm on /en/career and change language to cs, I get /cs/career . This page should not exist at all and when I render the page on server, I correctly get 404. Can I do something like this with next-i18next package? If so, how? I found this package https://github.com

u18next node setLng seems that doesn´t work

℡╲_俬逩灬. 提交于 2020-01-17 02:19:13
问题 I am getting a problem with the module i18next for node.js (using express). I initialize (on the app.js file) the module in this way: i18n.init({ ns: { namespaces: ['text'], defaultNs: 'text'}, resSetPath: 'locales/__lng__/new.__ns__.json', preload: ['es', 'uk', 'fr', 'ge', 'ru', 'it'], saveMissing: true, debug: true, lng:"es", sendMissingTo: 'fallback', useCookie: false, detectLngFromHeaders: false, detectLngFromPath: false }); and on the routes files I make something like this: router.get('

i18Next - NodeJS - How to change translations without reloading server

不问归期 提交于 2020-01-14 19:30:48
问题 I am using i18next package for NodeJS to enable translation. I am using it as standard with a json file for each language-COUNTRY pair. I'd like to build an admin page to edit translations without having to dig into the code; then, how can I "reload" the json files once edited by admin, without having to restart the server ? Also, is it possible to use a DB (i am using mongodb) instead of JSON files ? Would it be more appropriate in this case? 回答1: I wish i knew the answer to how to reload

How to use Knockout observables in i18next?

霸气de小男生 提交于 2020-01-11 09:21:10
问题 I'm trying to somehow dynamically use i18next translations together with Knockout.js, but I cant figure out how. Neither a custom Knockout binding or the i18next jQuery plugin seems to work with observable values. A demo of what I'm trying to achieve can be found here: http://jsfiddle.net/rdfx2/1/ A workaround is something like this, but I'd rather avoid that, if possible: <div data-bind="text: translate('key', observable)"></div> self.translate = function (key, value) { return i18next.t(key,

i18next load json error(404 Not Found)

六眼飞鱼酱① 提交于 2020-01-04 06:20:33
问题 this is my code at index.html <html> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"/> <script src="javascript/jquery-1.11.1.min.js" type="text/javascript"></script> <script src="javascript/i18next-1.7.4.js" type="text/javascript"></script> <title>i18next test</title> </head> <body> <p id="id001" data-i18n="first_data">first</p> </body> <script type="text/javascript"> $(document).ready(function(){ language_complete = navigator.language.split("-"); language =

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

北城以北 提交于 2020-01-02 12:56:50
问题 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 option (e.g. for SEO, maintainability, scalability etc.)? Ideally the translations will be stored in separate json files. The main thing I care about is translation - less so the other aspects of i18n and l10n. For example how might I translate: <html