Module: I18n

Defined in:
lib/kitchen/patches/i18n.rb

Overview

rubocop:disable Style/Documentation

Class Method Summary collapse

Class Method Details

.character_to_group(character) ⇒ Object



7
8
9
# File 'lib/kitchen/patches/i18n.rb', line 7

def self.character_to_group(character)
  I18n.locale == :pl ? character : I18n.transliterate(character)
end

.clear_string_sorterObject



23
24
25
# File 'lib/kitchen/patches/i18n.rb', line 23

def self.clear_string_sorter
  @string_sorter = nil
end

.locale=(locale) ⇒ Object



31
32
33
34
35
36
# File 'lib/kitchen/patches/i18n.rb', line 31

def self.locale=(locale)
  # We wrap the setting of locale so that we can clear the string sorter (so that it
  # gets reset to the new locale the next time it is used)
  clear_string_sorter
  self.original_locale = locale
end

.original_locale=Object



28
# File 'lib/kitchen/patches/i18n.rb', line 28

alias_method :original_locale=, :locale=

.sort_strings(first, second) ⇒ Object



11
12
13
# File 'lib/kitchen/patches/i18n.rb', line 11

def self.sort_strings(first, second)
  string_sorter.compare(first, second)
end

.string_sorterObject



15
16
17
18
19
20
21
# File 'lib/kitchen/patches/i18n.rb', line 15

def self.string_sorter
  @string_sorter ||= begin
    # TwitterCldr does not know about our :test locale, so substitute the English one
    locale = I18n.locale == :test ? :en : I18n.locale
    TwitterCldr::Collation::Collator.new(locale)
  end
end