Module Globalize::CoreExtensions::String
In: vendor/plugins/globalize/lib/globalize/localization/core_ext.rb

Methods

/   t   translate  

Attributes

direction  [RW]  Indicates direction of text (usually ltr [left-to-right] or rtl [right-to-left].

Public Instance methods

Translates the string into the active language. This is equivalent to translate(arg).

Example: "There are %d items in your cart" / 1 -> "There is one item in your cart"

[Source]

    # File vendor/plugins/globalize/lib/globalize/localization/core_ext.rb, line 32
32:       def /(arg)
33:         translate(nil, arg)
34:       end
t(default = nil, arg = nil)

Alias for translate

Translates the string into the active language. If there is a quantity involved, it can be set with the arg parameter. In this case string should contain the code %d, which will be substituted with the supplied number.

To substitute a string, give it as the arg parameter. It will be substituted for <tt>%s</dd>.

If there is no translation available, default will be returned, or if it’s not supplied, the original string will be returned.

[Source]

    # File vendor/plugins/globalize/lib/globalize/localization/core_ext.rb, line 23
23:       def translate(default = nil, arg = nil)
24:         Locale.translate(self, default, arg)
25:       end

[Validate]