Stats

129 Contributors: 7 Saturday, March 11, 2017
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap

I18n - Internationalization

Syntax

  • I18n.t("key")
  • I18n.translate("key") # equivalent to I18n.t("key")
  • I18n.t("key", count: 4)
  • I18n.t("key", param1: "Something", param2: "Else")
  • I18n.t("doesnt_exist", default: "key") # specify a default if the key is missing
  • I18n.locale #=> :en
  • I18n.locale = :en
  • I18n.default_locale #=> :en
  • I18n.default_locale = :en
  • t(".key") # same as I18n.t("key"), but scoped to the action/template it's called from

Related Examples