Sha256: 2160a1a1371cbe76fb3c1ceb66ced86ef20b1e2f6f95cb9d174a70cbb1062afe
Contents?: true
Size: 1005 Bytes
Versions: 1
Compression:
Stored size: 1005 Bytes
Contents
module LocaleApp MissingTranslationRecord = Struct.new(:key, :locale, :options) class MissingTranslations def initialize @translations = Hash.new { |h, k| h[k] = {} } end def add(locale, key, options = {}) record = MissingTranslationRecord.new(key, locale, options) @translations[locale][key] = record end def [](locale) @translations[locale] end # This method will get cleverer so we don't resend keys we've # already sent, or send multiple times for the same locale etc. # For now it's pretty dumb def to_send data = [] # need the sort to make specs work under 1.8 @translations.sort { |a, b| a.to_s <=> b.to_s }.each do |locale, records| records.each do |key, record| missing_data = {} missing_data[:key] = key missing_data[:locale] = locale missing_data[:options] = record.options data << missing_data end end data end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
localeapp-0.0.7 | lib/locale_app/missing_translations.rb |