From 983fa3b29f8eb0846f1b5cb6b8aea5f07dfb5ecb Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Sun, 22 May 2016 21:44:31 +0800 Subject: Update i18n guide about how to change locale and translations paths [ci skip] - config/application.rb no longer has comments about how to specify load paths or change default locale after https://github.com/rails/rails/commit/28dcadc0140dfdeb. --- guides/source/i18n.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'guides/source/i18n.md') diff --git a/guides/source/i18n.md b/guides/source/i18n.md index 0edfa072f8..92045e0647 100644 --- a/guides/source/i18n.md +++ b/guides/source/i18n.md @@ -109,12 +109,13 @@ The **translations load path** (`I18n.load_path`) is an array of paths to files NOTE: The backend lazy-loads these translations when a translation is looked up for the first time. This backend can be swapped with something else even after translations have already been announced. -The default `config/application.rb` file has instructions on how to add locales from another directory and how to set a different default locale. +You can change the default locale and also configure the translations load +paths in `config/application.rb` as follows: ```ruby -# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. -# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] -# config.i18n.default_locale = :de + config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + + config.i18n.default_locale = :de ``` The load path must be specified before any translations are looked up. To change the default locale from an initializer instead of `config/application.rb`: -- cgit v1.2.3 From 1c030578d6fddbe37c7e8a35db7bfb37278d349e Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Mon, 23 May 2016 18:51:52 -0700 Subject: - :scissors: space in code to match previous defaults. - Grammar edits. --- guides/source/i18n.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'guides/source/i18n.md') diff --git a/guides/source/i18n.md b/guides/source/i18n.md index 92045e0647..f3802a142f 100644 --- a/guides/source/i18n.md +++ b/guides/source/i18n.md @@ -109,12 +109,10 @@ The **translations load path** (`I18n.load_path`) is an array of paths to files NOTE: The backend lazy-loads these translations when a translation is looked up for the first time. This backend can be swapped with something else even after translations have already been announced. -You can change the default locale and also configure the translations load -paths in `config/application.rb` as follows: +You can change the default locale as well as configure the translations load paths in `config/application.rb` as follows: ```ruby config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - config.i18n.default_locale = :de ``` -- cgit v1.2.3