From cf21657f6e55346fa2f5555926f3f6a1e199de65 Mon Sep 17 00:00:00 2001 From: David Celis Date: Tue, 31 Jul 2012 09:17:16 -0700 Subject: Update I18n guide with details on multilingual Inflector [ci skip] Sorry; I forgot about the guides when I submitted this patch. Signed-off-by: David Celis --- guides/source/i18n.textile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/guides/source/i18n.textile b/guides/source/i18n.textile index 8ad6ee4b73..f67d487eee 100644 --- a/guides/source/i18n.textile +++ b/guides/source/i18n.textile @@ -405,6 +405,10 @@ So that would give you: TIP: Right now you might need to add some more date/time formats in order to make the I18n backend work as expected (at least for the 'pirate' locale). Of course, there's a great chance that somebody already did all the work by *translating Rails' defaults for your locale*. See the "rails-i18n repository at Github":https://github.com/svenfuchs/rails-i18n/tree/master/rails/locale for an archive of various locale files. When you put such file(s) in +config/locales/+ directory, they will automatically be ready for use. +h4. Inflection Rules For Other Locales + +Rails 4.0 allows you to define inflection rules (such as rules for singularization and pluralization) for locales other than English. In +config/initializers/inflections.rb+, you can define these rules for multiple locales. The initializer contains a default example for specifying rules for Spanish; follow that format for other locales as you see fit. + h4. Localized Views Rails 2.3 introduces another convenient localization feature: localized views (templates). Let's say you have a _BooksController_ in your application. Your _index_ action renders content in +app/views/books/index.html.erb+ template. When you put a _localized variant_ of this template: *+index.es.html.erb+* in the same directory, Rails will render content in this template, when the locale is set to +:es+. When the locale is set to the default locale, the generic +index.html.erb+ view will be used. (Future Rails versions may well bring this _automagic_ localization to assets in +public+, etc.) -- cgit v1.2.3