0

I am trying to store a default translation if a translation is missing in Rails.
After much struggle I came up with this:

backend = I18n.backend
if not backend.exists?(locale, key)
  backend.store_translations(locale, {key => locale.to_s + "-" + key.to_s})
end

The problem is, it stores the default values but it does not find them. Any idea what is wrong here?

Omid Kamangar
  • 5,768
  • 9
  • 40
  • 69
  • What code are you running to find the values after they are stored? – O-I Dec 25 '13 at 19:03
  • I am using a key-value backend and use Redis with it. The `KeyValue` backend is trying to find the values. I just use `t` to translate strings. – Omid Kamangar Dec 25 '13 at 19:48

1 Answers1

1

After so much headache, I found the problem:

It is because the dots in my keys are converted to their unicode character when stored, so, they are not found. For example actions.save is converted to actions\u0001save.

I don't know why this happens.

Omid Kamangar
  • 5,768
  • 9
  • 40
  • 69