Sha256: 5421877ba2a757a5b4799effddd7844c64d138e191a54d3a6a5a9adf7636a484

Contents?: true

Size: 676 Bytes

Versions: 10

Compression:

Stored size: 676 Bytes

Contents

module I18n
  module Backend
    module Fallback
      module Implementation

        # add the simplest possible fallback to the I18n.default_locale for missing translations
        def translate(locale, key, default_options = {})
          begin
            # will look for a translation in all backends (using requested locale)
            super(locale, key, default_options)
          rescue I18n::MissingTranslationData
            # if not found it will look again in all backends, but using I18n.default_locale as a locale
            super(I18n.default_locale, key, default_options)
          end
        end

      end

      include Implementation
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
exvo_globalize-0.5.3 lib/exvo_globalize/backend/fallback.rb
exvo_globalize-0.5.2 lib/exvo_globalize/backend/fallback.rb
exvo_globalize-0.5.1 lib/exvo_globalize/backend/fallback.rb
exvo_globalize-0.5.0 lib/exvo_globalize/backend/fallback.rb
exvo_globalize-0.4.0 lib/exvo_globalize/backend/fallback.rb
exvo_globalize-0.3.2 lib/exvo_globalize/backend/fallback.rb
exvo_globalize-0.3.1 lib/exvo_globalize/backend/fallback.rb
exvo_globalize-0.3.0 lib/exvo_globalize/backend/fallback.rb
exvo_globalize-0.2.1 lib/exvo_globalize/backend/fallback.rb
exvo_globalize-0.2.0 lib/exvo_globalize/backend/fallback.rb