class

I18n::Backend::Yaml

Inherits I18n::Backend::Base < Reference < Object

Constants

EMPTY_HASH = {} of String => String

Class methods

normalize(data : YAML::Any, path : String = "", final = Hash(String, YAML::Any).new)

Flatten paths

Source

Instance methods

available_locales
Source
load(*args)

Read files, normalize and merge all the translations

Source
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

Following keys are required :

__formats__:
      number:
        decimal_separator: ','
      precision_separator: '.'

      currency:
        symbol: '€'
      name: 'euro'
      format: '%s€'
Source
localize(locale : String, object : Time, scope = :time, format = nil) : String

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"
Source
localize(locale : String, object, scope = :number, format = nil) : String

Invokes #to_s on the object ignoring scope and format

Source
translate(locale : String, key : String, options : Hash | NamedTuple | Nil = EMPTY_HASH, count = nil, default = nil, iter = nil) : String
Source
translations
Source
translations=(translations : Hash(String, Hash(String, YAML::Any)))
Source

Macros

embed(dirs)
Source