Closed anthony0030 closed 1 year ago
Can you please provide some extra info? How are you exporting translations? Are you using guard, listen, watchman?
I was trying to use the guard. But I might switch to watchman to get it resolved faster.
I see this in the terminal:
16:11:15 - INFO - [guard-i18n-js] Changes detected: config/locales/view_components/en.yml
On initial load, the translation files get created with their initial content, but what gets written to them is still the initial contents.
/Users/anthonyveaudry/.rvm/gems/ruby-3.1.2/gems/i18n-js-4.0.0/lib/i18n-js.rb lines from 65
def self.translations
::I18n.backend.instance_eval do
has_been_initialized_before = respond_to?(:initialized?, true) && initialized?
init_translations unless has_been_initialized_before
binding.remote_pry
translations
end
end
If I run init_translations the translations get updated. The content of translations is always the initial translations from when it boots.
Guardfile
guard(:"i18n-js",
run_on_start: true,
config_file: './config/i18n.yml',
require_file: './config/environment.rb') do
watch(%r{^(app|config)/locales/.+\.(yml|po)$})
watch(%r{^config/i18n.yml$})
watch('config/jumpstart/Gemfile')
end
i18n.yml
---
translations:
- file: app/assets/locales/view_components/:locale.json
patterns:
- "*.view_components.*"
I am facing a similar problem that is described here #616
I installed the gem like this:
gem "i18n-js", github: "fnando/i18n-js", branch: "shell-out-listen-export"
The code on the branch you are working on seems to keep the language files updated on my setup.
Thanks for testing. I'm going to merge it and make a new release soon.
Hi @fnando, Thank you for getting this fixed in version 4.0.1!
Description
The output translation files don't update with new content
How to reproduce
Make an edit to a translation YML file
What do you expect
The JSON file receives updated content
What happened instead
The initial translations are written to the file
Software:
Full backtrace
NA