I am using Rails' 4.1.4 YAML locale files to store some translations, for example:
en:
words:
en:
passport: "passport"
ticket: "ticket"
train: "train"
de:
words:
en:
passport: "passport"
ticket: "ticket"
train: "train"
With this I can use t("words.#{to_language}.train")
to return train
for a German user (I18n.locale == :de) who has chosen english as his to_language
.
My question is: is there any way I can not repeat myself and have something like code below?
en OR de:
words:
en:
passport: "passport"
ticket: "ticket"
train: "train"
Perhaps I can assign all the content of words to a variable and then just do:
en:
all_words
de:
all_words
Thanks