aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/i18n.md
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2013-09-07 01:33:19 -0700
committerXavier Noria <fxn@hashref.com>2013-09-07 01:33:19 -0700
commitc989a18a74d970be86c537766f14916bd06fe176 (patch)
treecf2ab71e426364c6b82e884b00146acf1345abc1 /guides/source/i18n.md
parent6a91a3307ff6556225ab8717617074cea20222e0 (diff)
parent2c8bc2cdcdb7b144b7a583d24922fd8064bcff3d (diff)
downloadrails-c989a18a74d970be86c537766f14916bd06fe176.tar.gz
rails-c989a18a74d970be86c537766f14916bd06fe176.tar.bz2
rails-c989a18a74d970be86c537766f14916bd06fe176.zip
Merge pull request #12155 from jetthoughts/reformat_guides_code_examples
Use Ruby on Rails Coding Conventions for code examples in the guides
Diffstat (limited to 'guides/source/i18n.md')
-rw-r--r--guides/source/i18n.md9
1 files changed, 5 insertions, 4 deletions
diff --git a/guides/source/i18n.md b/guides/source/i18n.md
index ead9c6b94d..cbc2683a00 100644
--- a/guides/source/i18n.md
+++ b/guides/source/i18n.md
@@ -282,10 +282,11 @@ def set_locale
I18n.locale = extract_locale_from_accept_language_header
logger.debug "* Locale set to '#{I18n.locale}'"
end
+
private
-def extract_locale_from_accept_language_header
- request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first
-end
+ def extract_locale_from_accept_language_header
+ request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first
+ end
```
Of course, in a production environment you would need much more robust code, and could use a plugin such as Iain Hecker's [http_accept_language](https://github.com/iain/http_accept_language/tree/master) or even Rack middleware such as Ryan Tomayko's [locale](https://github.com/rack/rack-contrib/blob/master/lib/rack/contrib/locale.rb).
@@ -742,7 +743,7 @@ en:
other: Dudes
```
-Then `User.model_name.human(:count => 2)` will return "Dudes". With `:count => 1` or without params will return "Dude".
+Then `User.model_name.human(count: 2)` will return "Dudes". With `count: 1` or without params will return "Dude".
#### Error Message Scopes