Module | I18n::Backend::Base |
In: |
lib/active_support/vendor/i18n-0.4.1/i18n/backend/base.rb
|
RESERVED_KEYS | = | [:scope, :default, :separator, :resolve] |
RESERVED_KEYS_PATTERN | = | /%\{(#{RESERVED_KEYS.join("|")})\}/ |
DEPRECATED_INTERPOLATION_SYNTAX_PATTERN | = | /(\\)?\{\{([^\}]+)\}\}/ |
INTERPOLATION_SYNTAX_PATTERN | = | /%\{([^\}]+)\}/ |
Returns an array of locales for which translations are available ignoring the reserved translation meta data key :i18n.
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
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}"
Note that you have to double escape the \ when you want to escape the {{…}} key in a string (once for the string and once for the interpolation).
returns true when the given value responds to :call and the key is an interpolation placeholder in the given string
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.
Picks a translation from an array according to English pluralization rules. It will pick the first translation if count is not equal to 1 and the second translation if it is equal to 1. Other backends can implement more flexible or complex pluralization rules.