Project

General

Profile

« Previous | Next » 

Revision c2f9dd87

Added by Marc Dequènes about 13 years ago

  • ID c2f9dd871aeff90135d85c2fa43ce6ad62e35e30

[evol] I18n: new helpers to setup gettext domains and deferred translations (and one to inject the correct domain into specific core classes in order to be able to use cyborg-local translations into them (currently only needed for DSL classes))

View differences:

lib/cyborghood/base/language.rb
require 'http_headers'
# helpers
class Module
include GetText
@@ch_translations = Set.new
def add_translations(domain)
if @@ch_translations.include? domain
textdomain(domain)
else
bindtextdomain(domain, {:path => CyborgHood::Config::L10N_DIR, :output_charset => "UTF-8"})
@@ch_translations << domain
end
end
def add_deferred_translations(cyborg_model = nil)
domain = 'cyborghood'
domain += '_' + cyborg_model if cyborg_model
add_translations(domain)
include CyborgHood::I18nTranslation
end
end
module CyborgHood
class I18nController
include Singleton

Also available in: Unified diff