Sha256: 86f1e93c77ac68947276ac527360b524f455dccd9a29c3d0cba303c3d9ebb0b4
Contents?: true
Size: 913 Bytes
Versions: 1
Compression:
Stored size: 913 Bytes
Contents
class ActiveRecord::Base include I18n::Gettext include I18n::Gettext::Singleton end ActionController::Translation.module_eval do extend I18n::Gettext end # Extending with I18n::Gettext is not working for translation helper # so we have to declare gettext methods here. Methods overwritten by # Globalize2 also have to be restored. ActionView::Helpers::TranslationHelper.module_eval do def gettext(key, options={}) I18n.gettext(key, options) end alias :_ :gettext def translate(key, options = {}) options[:raise] = true I18n.translate(scope_key_by_partial(key), options) rescue I18n::MissingTranslationData => e keys = I18n.send(:normalize_translation_keys, e.locale, e.key, e.options[:scope]) content_tag('span', keys.join(', '), :class => 'translation_missing') end alias :t :translate def localize(*args) I18n.localize *args end alias :l :localize end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kriss-gettext_i18n-0.2.1 | lib/rails/extend.rb |