I get this error in view:
translation missing:
da.datetime.distance_in_words.about_x_hours
My da locale file: http://pastie.org/2944890
My view:
<%= distance_of_time_in_words(Time.new, konkurrancer.udtraekkes) %>
I have added this to my application.rb:
config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.default_locale = :da
If I remove the I18 config the helper does work on english.
UPDATE:
My configuration in my config/enviorments/devolpment.rb:
config.i18n.load_path += Dir[Rails.root.join('locales', '*.{rb,yml}').to_s]
config.i18n.default_locale = :da
config.i18n.locale = :da
My translation file in config/locales/da.yml:
da:
datetime:
distance_in_words:
x_days:
one: '1 day'
other: '{{count}} dage'
And I get this error view:
translation missing: da.datetime.distance_in_words.x_days
You are close - all you have to do is fix the indentation in your locale file. Starting at line #8 to the end of the file, increase the indentation by one unit. This will allow Rails to resolve da[:datetime][:distance_in_words][:about_x_hours] to the proper value.
Try:
distance_in_words:
x_days: "%{count} days"
or
distance_in_words:
x_days:
one: "1 day"
other: "%{count} days"
You can get all the samples here: https://github.com/svenfuchs/rails-i18n/tree/master/rails/locale
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With