module I18n::Backend::Transliterator - i18n-0.6.11 Documentation

# module I18n::Backend::Transliterator

### Constants

DEFAULT_REPLACEMENT_CHAR

### Public Class Methods

get(rule = nil) click to toggle source

Get a transliterator instance.

    # File lib/i18n/backend/transliterator.rb, line 16
    def self.get(rule = nil)
      if !rule || rule.kind_of?(Hash)
        HashTransliterator.new(rule)
      elsif rule.kind_of? Proc
        ProcTransliterator.new(rule)
      else
        raise I18n::ArgumentError, "Transliteration rule must be a proc or a hash."
      end
    end

### Public Instance Methods

transliterate(locale, string, replacement = nil) click to toggle source

Given a locale and a UTF-8 string, return the locale's ASCII approximation for the string.

    # File lib/i18n/backend/transliterator.rb, line 8
    def transliterate(locale, string, replacement = nil)
      @transliterators ||= {}
      @transliterators[locale] ||= Transliterator.get I18n.t(:'i18n.transliterate.rule',
        :locale => locale, :resolve => false, :default => {})
      @transliterators[locale].transliterate(string, replacement)
    end