nimblehq / rails-templates

Our optimized Rails templates used in our projects

Home Page:https://nimblehq.co

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Upgrade i18n-js to v4

andyduong1920 opened this issue · comments

Why

  • We are using both i18n-js Ruby and i18n-js Node package v3

  • To upgrade from v3 to v4, it requires lot of changes, I tried it but failed in some step, some task I remember was

    import { I18n } from "i18n-js";
    import translations from "./translations.json";
    
    const i18n = new I18n(translations);
    
  • Remove the config.middleware.use I18n::JS::Middleware as v4 doesn't have it
  • Rename the config/i18n-js.yml to config/i18n.yml and update the content
 translations:
 - file: 'app/javascript/translations/translations.js'
   pattern:
    - '*'
  • Replace the task i18n:js:export to i18n export
  • Update the relative JS files like app/javascript/initializers/i18n.js

I tried all of them, but having 1 last issue on JS is the I18n module is not define not sure about that, I create this dedicate ticket for this upgrading, happy coding 🍺

Who Benefits?

Developers