Represents a locale.
Methods
Attributes
| [RW] | map | The localization map. |
Public Class methods
[ show source ]
# File lib/raw/util/localization.rb, line 14
14: def initialize(map)
15: parse_hash(map)
16: end
Public Instance methods
Alias for #translate
Transalte the given key.
- args
- An array of arguments. The first argument is the translation key. If additional arguments are provided they are used for sprintf interpolation.
This method is also aliased as
[]
[ show source ]
# File lib/raw/util/localization.rb, line 30
30: def translate(*args)
31: if xlated = @map[args.shift]
32: if xlated.is_a?(String)
33: args.empty? ? xlated : sprintf(xlated, *args)
34: else
35: xlated.call(*args)
36: end
37: end
38: end