We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
rake tolk:import seen to not properly flatten yml So some hash are stored as translations
rake tolk:import
Here is a screen:
Raising me errors like
ActionView::Template::Error: translation data {:uno=>"fase", :altro=>"fasi"} can not be used with :count => 1. key 'one' is missing.
Because my users edited hash keys
It seen like the problem come from the flat_hash gem When i do
Tolk::Locale.flat_hash(parsed_yaml).any? { |_,v| v.is_a? Hash } => true
however I fixed it by adding this
Tolk::Locale.class_eval do def self.flat_hash(hash) res = {} stack = [OpenStruct.new(current_path: [], value: hash)] while (current = stack.pop) if current.value.is_a? Hash current.value.each { |k,v| stack << OpenStruct.new(current_path: current.current_path + [k], value: v) } else res[current.current_path.join('.')] = current.value end end res end end
Into app/config/initializers/tolk.rb
app/config/initializers/tolk.rb
The text was updated successfully, but these errors were encountered:
It seen like if my users now forgot a key, neither one or other, I18n is raising errors instead of fallbacking 🎉
Here is another issue about this svenfuchs/rails-i18n#893
Sorry, something went wrong.
No branches or pull requests
Hello,
rake tolk:import
seen to not properly flatten ymlSo some hash are stored as translations
Here is a screen:
Raising me errors like
Because my users edited hash keys
It seen like the problem come from the flat_hash gem
When i do
however I fixed it by adding this
Into
app/config/initializers/tolk.rb
The text was updated successfully, but these errors were encountered: