How to add values dynamically to I18n?
- by Dima Goltsman
I have many ymls in my rails app, and i want to put some of them in other service, so that i can call this from multiple places.
the response of this call will be a hash.
{"en" :
{"test" :
{"text1" : "hi english"},
{"text2" : "mambo number %{num}"}
},
"es" :
{"test" :
{"text1" : "hi espaniol"},
{"text2" : "mamboes numeros %{num}"}
}
}
is there a way i can load that hash into I18n translations
like
I18n.add_translations(some_hash)
so i can access them with
I18n.t("test.text1")
I18n.t("test.text2", :num => 5)
how can i achieve it?