class Rails::Pseudoloc::Backend
An I18n::Backend that pseudolocalizes all translations requested of it and delegates to another backend for the actual translations and localizations.
Public Class Methods
new(backend)
click to toggle source
Creates a pseudolocalized backend that gets all its translations from ‘backend`.
Calls superclass method
# File lib/rails/pseudoloc/backend.rb, line 13 def initialize(backend) super(backend) @codec = Codec.new end
Public Instance Methods
translate(locale, key, options = {})
click to toggle source
Pseudolocalizes the translation returned from the actual backend.
# File lib/rails/pseudoloc/backend.rb, line 20 def translate(locale, key, options = {}) value = __getobj__.translate(locale, key, options) value.is_a?(String) ? @codec.encode(value) : value end