Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

271
Views
i18n-js "missing translation" in Rails app

I have a Rails app that has the languages English, French, and German. I have some JavaScript code that I need to translate. I used the i18n-js gem, but it doesn't work.

My setup:

Manifest.js:

//= require i18n
//= require i18n.js
//= require i18n/translations

config/application.rb:

config.i18n.available_locales = :de

I only want the German version right now, so this is correct.

config/i18n-js.yml:

 translations:
   - file: "app/assets/javascripts/i18n/translations.js"
     only: "*"
     pretty_print: true

Gemfile:

gem 'i18n-js'

Package.json:

 "i18n-js": "^3.8.0",

application.js:

import I18n from 'i18n-js'

window.I18n = I18n
I18n.defaultLocale = "de";
I18n.locale = "de";

My translations.js file looks like this:

I18n.translations || (I18n.translations = {});
I18n.translations["de"] = I18n.extend((I18n.translations["de"] || {}), {
  "activerecord": {
    "attributes": {
      "booking": {
        "comments": "Bemerkungen",
etc.

I can access the I18n object in the console, but as soon as I try to display a translation, it doesn't work: translation missing

Running rake tmp:clear and/or adding config.middleware.use I18n::JS::Middleware to my application.rb doesn't work.

Why isnt't it working?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!