-1

I'm using rails 5.0.2 with spree 3.2.0.rc3. I have this keys in my translation file:

ru:
  spree:
    shipment_states:
      canceled: 'отменен'
      canceled_test: 'test'

And in development I catch I18n::MissingTranslationData exception with message: 'translation missing: ru.spree.shipment_states.canceled'. I can see from console on exception page, that my translation actualy loaded ('canceled_test' key is added), but 'canceled' key is ignored for some reason:

>> (I18n.t '.')[:spree][:shipment_states]
=> {:backorder=>"задерживается", :canceled=>nil, :partial=>"частично", :pending=>"ожидает", :ready=>"готов", :shipped=>"отправлен", :canceled_test=>"test"}

Why? How can I debug this?

vasily.sib
  • 3,871
  • 2
  • 23
  • 26

1 Answers1

0

Check your application.rb for the presence of a line:

config.i18n.default_locale = :ru

then try to add all of the states to 'shipment_states'. In my case earned the following code:

ru:
  spree:
    shipment_states:
      backorder: 'Задерживается'
      canceled: 'Отменен'
      partial: 'Доставлен частично'
      pending: 'Ожидает подтверждения'
      ready: 'Готов к отправке'
      shipped: 'Отправлен'
D7na
  • 106
  • 9
  • I set default locale in a separate initializer, as comment in application.rb recomends. I'm sure that my translation file is loaded (I've add a new key 'canceled_test', which exists only in :ru locale, and I can see it in output of (I18n.t '.')[:spree][:shipment_states]. It seems that something overwrite 'canceled' key value with nil:\ – vasily.sib Mar 20 '17 at 08:43
  • I do not know exactly why this error occurs, and you are not the only one with a similar question (http://stackoverflow.com/questions/41540081/spree-translation-missing-shipment-details), but I was helped in my time by simply copying a piece of code from File of the official repository: https://github.com/spree/spree/blob/master/core/config/locales/en.yml and making changes. When I changed only the "canceled" section, I had the same error as you. – D7na Mar 20 '17 at 10:01
  • Ok, I'll check it – vasily.sib Mar 20 '17 at 10:26