How to display different partial values ​​depending on the current locale

I got index.erb and index-de.erb and I saw an example somewhere where it caused index-de to be displayed when I18n.locale was: de, but I just tried and it didn't work. and I might not find any documentation on the matter. So does this really work or do I need an additional plugin for this?

0


a source to share


2 answers


they should be named index.LOCALE.EXTENSION, i.e. index.de.erb or index.de.html.erb for locale (I18n.locale)



+1


a source


Localization is built into rails as of 2.2; you probably want to check out the i18n screencast and / or guide .



Edit: in particular, check out section 3.3 of the "Localized Views" manual. The short answer is that the correct filename is index.de.html.erb.

+1


a source







All Articles