简体   繁体   中英

rails i18n adjectives

I'm currently stuck with a small but not so uncommon problem in rails i18n ( hopefully I just haven't used the wrong search terms...)

In a standard rails crud app, you often have models like "contract", "group" etc.. So far, if you want a button for "new group" oder "new contract", this is simple in the english language, since it's basically always something like "new" + model_name.

Unfortunately, languages like german are not so computer-friendly :)

"new contract" translates to "neuer vertrag" while "new group" translates to "neue gruppe" (note the adjective change). So, no problem with pluralisation this time but with adjective changes. Is there any rails i18n support for such cases? Don't want to use ugly i18n concatenation :)

thanks a lot!

just to understand your question correctly, you don't want to translate 'new' to german?

What is wrong with:

en:
  new_contract: New contract
  new_group: New group

de:
  new_contract: Neuer Vertrag
  new_group: Neue Gruppe

This is the standard way to do it and I don't see any advantage of DRYing up the 'new'. You remove something from the context there. Btw. you have this problem in a lot of languages. It is not possible to translate an adjective just once and then reuse, since it belongs to another word (cannot stand in its own context).

I would definitely go with the approach above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM