mercredi 30 décembre 2015

I18n.t Translation Missing Default Value Nil

So I know how return a default value if I get "translation missing:" when reading a yaml file.

some = I18n.t("something.something_else", default: "value")

But how do I do that in the Ruby way if I want the default value to be nil? I know I can regex and match for "translation missing:" from the variable some and if it matches, I would have it assign to nil. But what I wanted to do is have

some = I18n.t("something.something_else", default: nil)

But it just returned translation missing for me. Does anyone know a good way?

Aucun commentaire:

Enregistrer un commentaire