diff options
author | Andrew White <pixeltrix@users.noreply.github.com> | 2017-01-04 10:52:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-04 10:52:31 +0000 |
commit | d304aefc91b485176b3d2fdc2f24147c1f78c132 (patch) | |
tree | a0efa1a374f9a7b0c1b0ceb98bb2001ce74fbe04 /guides/source | |
parent | 50cb1b697c9409e28e5e515029d6292335a24a17 (diff) | |
parent | 864ef6be9ea74b22e04297fa9d269897d729863c (diff) | |
download | rails-d304aefc91b485176b3d2fdc2f24147c1f78c132.tar.gz rails-d304aefc91b485176b3d2fdc2f24147c1f78c132.tar.bz2 rails-d304aefc91b485176b3d2fdc2f24147c1f78c132.zip |
Merge pull request #27552 from jarijokinen/fix-default-locale-code-example
Fix default locale code example [ci skip]
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/i18n.md | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/guides/source/i18n.md b/guides/source/i18n.md index fd54bca4ff..df5869f9ca 100644 --- a/guides/source/i18n.md +++ b/guides/source/i18n.md @@ -72,11 +72,13 @@ I18n.l Time.now There are also attribute readers and writers for the following attributes: ```ruby -load_path # Announce your custom translation files -locale # Get and set the current locale -default_locale # Get and set the default locale -exception_handler # Use a different exception_handler -backend # Use a different backend +load_path # Announce your custom translation files +locale # Get and set the current locale +default_locale # Get and set the default locale +available_locales # Whitelist locales available for the application +enforce_available_locales # Enforce locale whitelisting (true or false) +exception_handler # Use a different exception_handler +backend # Use a different backend ``` So, let's internationalize a simple Rails application from the ground up in the next chapters! @@ -124,6 +126,9 @@ The load path must be specified before any translations are looked up. To change # Where the I18n library should search for translation files I18n.load_path += Dir[Rails.root.join('lib', 'locale', '*.{rb,yml}')] +# Whitelist locales available for the application +I18n.available_locales = [:en, :pt] + # Set default locale to something other than :en I18n.default_locale = :pt ``` |