module RubyI18n

Overview

Namespace for logic relating to ruby-i18n's YAML format.

This is a reimplementation of the ruby-i18n YAML format from the ruby-i18n project.

In crystal, this is often adapted into the crystal-i18n format seen in the following projects:

and any of the other implementations the community has made.

Each of the variants in Crystal has some slight variations compared with the original ruby-i18n. Minor alternations are needed to be compatible with Lens. See the usage documentation for more information

Defined in:

backend/ruby-i18n-yaml/ruby-i18n-yaml.cr

Class Method Summary

Class Method Detail

def self.define_rule(locale : String, value : Int32 | Int64 | Float64 -> String) #

Set pluralization rules for the given locale

This allows you to overwrite or even define new pluralization rules for whatever locale you desire.

RubyI18n.define_rule("ar", ->(n : Int32 | Int64 | Float64) {
  case
  when n == 0             then "zero"
  when n == 1             then "one"
  when n == 2             then "two"
  when 3..10 === n % 100  then "few"
  when 11..99 === n % 100 then "many"
  else                         "other"
  end
})

[View source]
def self.plural_rules : Hash(String, Int32 | Int64 | Float64 -> String) #

Returns all defined CLDR plural rules


[View source]