Questions tagged [i18n-node]

24 questions
9
votes
3 answers

node.js: is there no way to put HTML into i18n-node JSON translation files?

The question says it all. If I put HTML directly into the (JSON-formatted) translation file, like this: "test_html" : "click here", I get this in my HTML: click <a…
jasper
  • 137
  • 1
  • 9
5
votes
0 answers

How to make a folder in i18n-node and have multiple json files of a same language?

I have watched a video of a coursera, where the speaker stated that in locales folder they have folders for each language and in the folder language there are json files of each single page. So my question is how to implement it in i18n? Example…
planacte
  • 55
  • 8
4
votes
1 answer

node.js i18n - Cannot read property 'toLowerCase' of undefined

I always receive the following error when calling i18n.__n('..'): TypeError: Cannot read property 'toLowerCase' of undefined at Object.i18nTranslatePlural [as __n] (/home/runner/node_modules/i18n/i18n.js:367:31) at evalmachine.:14:18 at…
3
votes
1 answer

node.js i18n: "ReferenceError: __ is not defined"

Throughout my app I use i18n without problem. However, for email send through a cron job, I get the error: ReferenceError: __ is not defined In app.js I configure i18n: const i18n = require("i18n"); i18n.configure({ locales: ["en"], …
Nick
  • 3,496
  • 7
  • 42
  • 96
3
votes
0 answers

How to translate outside router, request using i18n + express?

Currently I have integrated successfully to routes, request and config. Application Structure app.js - The entry point to our application. This file defines our express server and connects it to MongoDB using mongoose. It also requires the routes…
wilfredonoyola
  • 485
  • 5
  • 12
3
votes
0 answers

Prevent i18n from converting special characters to HTML

I want to translate a sentence with i18n within an express app using a google cloud function. Everything works despite that special characters are transformed into HTML special notation. var STRING_TO_TRANSLATE = "{{name}} is here", var…
Thomas
  • 31
  • 1
3
votes
1 answer

Multilingual validation message with Mongo Schema and i18n

I'm new to Node.js/Mongo and I was wondering how I could use i18n with my validation. So far here's what I have Schema const UserSchema = new Schema({ language: { type: String, enum: ['fr', 'en'] }, email: { type:…
Sam Bellerose
  • 1,782
  • 2
  • 18
  • 43
3
votes
1 answer

Paths in nodejs

I'm facing a problem with paths in nodeJs, I route the user to the index page when he specifies the language in the url like this : app.all('/:locale?/index',function(req,res,next){ if(!req.params.locale){ console.log('no param'); …
3
votes
1 answer

use i18n-node in server-side express application

I can't figure out how I should use i18n-node module inside my application. Within views, for static texts, it's easy, it works perfectly but... Here is my problem : Sometimes I have to set some error messages or something else, e.g…
Oliboy50
  • 2,661
  • 3
  • 27
  • 36
2
votes
1 answer

Client side rendering using i18n and ejs

I'm currently developing a music platform, using NodeJs, Express 4.0, and EJS as my template engine. As we must have a player constantly playing through our site navigation, as for SoundCloud, my site content is loaded dynamically with AJAX calls…
M. Arb
  • 79
  • 1
  • 9
2
votes
5 answers

Express and i18n default locale not working

Im trying to set up i18n-node and Expressjs. My conf is this: // i18n Configuration ========================================================= var i18nconf = { locales : ["en", "es"], cookie : "locale", defaultLocale : "en", …
mdv
  • 925
  • 3
  • 14
  • 28
2
votes
1 answer

How to divide locale files in a modular express app with i18n-node?

I'm using i18n-node to translate a multilingual express web-app. The i18n-node package allows you to specify a single folder for all of the locale json files which contain all the strings in the UI of the app. Assuming the app is getting bigger &…
Ajar
  • 1,051
  • 3
  • 13
  • 29
2
votes
1 answer

How can get a non-trivial i18n translation to work using Sails.js?

Using Sails.js version 0.10.x and trying to get the i18n stuff to work. I have the following in my config/locales/en.json { "countries": { "au": { "name": "Australia", "fiatCurrency": "AUD", "subnationalDivisions": { …
Dave Sag
  • 13,266
  • 14
  • 86
  • 134
1
vote
0 answers

i18n-node: split up in multiple files for one language

I use the node module i18n (with Node & Express) for internationalization. Because the json file is becoming so long, I would prefer to use multiple json files for a single language. Is this possible within this node module? I am thinking of for…
Marty
  • 2,132
  • 4
  • 21
  • 47
1
vote
0 answers

how to pass response of i18n in component

I have implemented multilanguage translation using https://github.com/mashpie/i18n-node in nodejs express, in the backend(nodejs) am passing translated json as response to use in components, when i try it showing error as converted circular…
Senthil
  • 961
  • 1
  • 8
  • 21
1
2