Ruby on RailsI18n - 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