提交 d304aefc 编写于 作者: A Andrew White 提交者: GitHub

Merge pull request #27552 from jarijokinen/fix-default-locale-code-example

Fix default locale code example [ci skip]
......@@ -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
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册