Have you read i18n guide http://guides.rubyonrails.org/i18n.html ?:)
2010/11/26 Philip K. <philip.k...@googlemail.com>:
> --
> You received this message because you are subscribed to the Google Groups "rails-i18n" group.
> To post to this group, send email to rails...@googlegroups.com.
> To unsubscribe from this group, send email to rails-i18n+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rails-i18n?hl=en.
>
>
tl;dr: you probably don't wanna do it.
DRY is a principle that applies to code but not translations. When we abstract our code then we are the ones who are in control of applying general rules to it. But when it comes to translations we must leave your translators in control and therefor don't want to abstract translations.
The reason for that is that
1. there aren't that many general rules that apply to language, all of the time, spoken languages have tons of exceptions for probably any rule you'd name
2. even if there are such rules we as developers don't know them - that's why there are translators
Therefor one should allow translators to translate every single string the way they want - even if there's tons of duplication then.
One practical example where what you're trying to do could potentially crash on the floor is when your :namespace translation needs to be inflected when it's interpolated (inserted) into this particular translation for :submit in *this particular* context on your page.
That said, there are some situations where even Rails does something similar.
You can do it like this:
de:
new:
submit: "%{namespace} anlegen"
and then
I18n.t(:'new.submit', :namespace => I18n.t(:namespace))
Reason for that is that
1. There isn’t that a lot of all-purpose rules that pertain to verbal
communication, all of the time, spoken languages have plenty of
exceptions for almost certainly any rule you'd name
2. Even if there is such policy we as developers don't know them -
That’s why there are translators
Therefore one should agree to translators to translate every single cord
The way they want - even if there's heaps of repetition then.
http://www.translatebyhumans.com/
--
Posted via http://www.ruby-forum.com/.