Module I18n::Backend::Base
In: lib/i18n/backend/base.rb

Methods

Included Modules

I18n::Backend::Transliterator

Public Instance methods

Returns an array of locales for which translations are available ignoring the reserved translation meta data key :i18n.

Accepts a list of paths to translation files. Loads translations from plain Ruby (*.rb) or YAML files (*.yml). See load_rb and load_yml for details.

Acts the same as strftime, but uses a localized version of the format string. Takes a key from the date/time formats translations as a format argument (e.g., :short in :’date.formats‘).

This method receives a locale, a data hash and options for storing translations. Should be implemented

Protected Instance methods

Evaluates defaults. If given subject is an Array, it walks the array and returns the first translation that can be resolved. Otherwise it tries to resolve the translation directly.

Interpolates values into a given string.

  interpolate "file %{file} opened by %%{user}", :file => 'test.txt', :user => 'Mr. X'
  # => "file test.txt opened by %{user}"

Loads a single translations file by delegating to load_rb or load_yml depending on the file extension and directly merges the data to the existing translations. Raises I18n::UnknownFileType for all other file extensions.

Loads a plain Ruby translations file. eval‘ing the file must yield a Hash containing translation data with locales as toplevel keys.

Loads a YAML translations file. The data must have locales as toplevel keys.

The method which actually looks up for the translation in the store.

Picks a translation from a pluralized mnemonic subkey according to English pluralization rules :

  • It will pick the :one subkey if count is equal to 1.
  • It will pick the :other subkey otherwise.
  • It will pick the :zero subkey in the special case where count is equal to 0 and there is a :zero subkey present. This behaviour is not stand with regards to the CLDR pluralization rules.

Other backends can implement more flexible or complex pluralization rules.

Resolves a translation. If the given subject is a Symbol, it will be translated with the given options. If it is a Proc then it will be evaluated. All other subjects will be returned directly.

[Validate]