module CrystalI18n
Overview
Namespace for logic relating to the crystal-i18n format.
This is a reimplementation of the crystal-i18n format from the following projects:
and any of the other similar implementations the community has made.
Note that this is still experimental, mainly in regards to plural-forms. Other than that, it should be fully usable and accurate.
EXPERIMENTAL
Defined in:
backend/crystal-i18n/crystal-i18n.crClass Method Summary
- 
        .define_rule(locale : String, value : Int32 | Int64 | Float64 -> String)
        
          
Set pluralization rules for the given locale
 - 
        .plural_rules : Hash(String, Int32 | Int64 | Float64 -> String)
        
          
Returns all defined CLDR plural rules
 
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.
CrystalI18n.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
})
        
        
        def self.plural_rules : Hash(String, Int32 | Int64 | Float64 -> String)
        #
      
      
        Returns all defined CLDR plural rules