Class: TRMNL::I18n::Synchronization::Processor
- Inherits:
-
Object
- Object
- TRMNL::I18n::Synchronization::Processor
- Defined in:
- lib/trmnl/i18n/synchronization/processor.rb
Overview
Copies new key/value pairs from the source locale (typically ‘en’) to destination locales.
Instance Method Summary collapse
- #call(source_locale = "en") ⇒ Object
-
#initialize(repository, reducer: ValueReducer, logger: Cogger.new(id: "trmnl-i18n")) ⇒ Processor
constructor
A new instance of Processor.
Constructor Details
#initialize(repository, reducer: ValueReducer, logger: Cogger.new(id: "trmnl-i18n")) ⇒ Processor
Returns a new instance of Processor.
16 17 18 19 20 |
# File 'lib/trmnl/i18n/synchronization/processor.rb', line 16 def initialize repository, reducer: ValueReducer, logger: Cogger.new(id: "trmnl-i18n") @repository = repository @reducer = reducer @logger = logger end |
Instance Method Details
#call(source_locale = "en") ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/trmnl/i18n/synchronization/processor.rb', line 22 def call source_locale = "en" repository.locales.each do |destination_locale| log_info "Syncing #{repository.name}/#{destination_locale}..." destination_root = repository.load destination_locale result = add_missing_contents source_locale, destination_locale, destination_root repository.save destination_locale, result end end |