class I18n::Backend::Yaml
- I18n::Backend::Yaml
- I18n::Backend::Base
- Reference
- Object
Defined in:
i18n/backend/yaml.crConstant Summary
-
EMPTY_HASH =
{} of String => String
Class Method Summary
Instance Method Summary
- #available_locales : Array(String)
- #exists?(locale : String, key : String, count = nil) : Bool
-
#load(*args)
Read files, normalize and merge all the translations
-
#localize(locale : String, object : Number, scope = :number, format = nil) : String
Localize a number or a currency Use the format if given scope can be one of
:number
( default ),:currency
-
#localize(locale : String, object : Time, scope = :time, format = nil) : String
Localize a date or a datetime using the format if provided.
-
#localize(locale : String, object, scope = :number, format = nil) : String
Invokes
#to_s
on theobject
ignoringscope
andformat
- #translate(locale : String, key : String, options : Hash | NamedTuple? = EMPTY_HASH, count = nil, default = nil, iter = nil) : String
- #translations : Hash(String, Hash(String, YAML::Any))
- #translations=(translations)
Macro Summary
Instance methods inherited from class I18n::Backend::Base
available_locales : Array(String)
available_locales,
exists?(locale : String, key : String, count = nil) : Bool
exists?,
load(*args)
load,
localize(locale : String, object, scope = :number, format = nil) : String
localize,
translate(locale : String, key : String, opitions : Hash | NamedTuple?, count = nil, default = nil, iter = nil) : String
translate
Class Method Detail
Flatten paths
Instance Method Detail
Localize a number or a currency
Use the format if given
scope can be one of :number
( default ), :currency
Following keys are required :
__formats__:
number:
decimal_separator: ','
precision_separator: '.'
currency:
symbol: '€'
name: 'euro'
format: '%s€'
Localize a date or a datetime using the format if provided. scope can be one of :time ( default ), :date, :datetime
NOTE According to ISO 8601, Monday is the first day of the week
Following keys are required :
__formats__:
date:
formats:
default: "%Y-%m-%d"
long: "%A, %d of %B %Y"
month_names: [January, February, March, April, May, June, July, August, September, October, November, December]
abbr_month_names: [Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec]
day_names: [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]
abbr_day_names: [Mon, Tue, Wed, Thu, Fri, Sat, Sun]
time:
formats:
default: "%I:%M:%S %p"
Invokes #to_s
on the object
ignoring scope
and format
def translate(locale : String, key : String, options : Hash | NamedTuple? = EMPTY_HASH, count = nil, default = nil, iter = nil) : String
#