Class Index [+]

Quicksearch

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 17
17:       def self.get(rule = nil)
18:         if !rule || rule.kind_of?(Hash)
19:           HashTransliterator.new(rule)
20:         elsif rule.kind_of? Proc
21:           ProcTransliterator.new(rule)
22:         else
23:           raise I18n::ArgumentError, "Transliteration rule must be a proc or a hash."
24:         end
25:       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 9
 9:       def transliterate(locale, string, replacement = nil)
10:         @transliterators ||= {}
11:         @transliterators[locale] ||= Transliterator.get I18n.t(:'i18n.transliterate.rule',
12:           :locale => locale, :resolve => false, :default => {})
13:         @transliterators[locale].transliterate(string, replacement)
14:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.