class Money::LocaleBackend::I18n

Constants

KEY_MAP

Public Class Methods

new() click to toggle source
# File lib/money/locale_backend/i18n.rb, line 11
def initialize
  raise NotSupported, 'I18n not found' unless defined?(::I18n)
end

Public Instance Methods

lookup(key, _) click to toggle source
# File lib/money/locale_backend/i18n.rb, line 15
def lookup(key, _)
  i18n_key = KEY_MAP[key]

  ::I18n.t i18n_key, scope: 'number.currency.format', raise: true
rescue ::I18n::MissingTranslationData
  ::I18n.t i18n_key, scope: 'number.format', default: nil
end