Class: CodelessCode::Commands::ListTranslations

Inherits:
Object
  • Object
show all
Defined in:
lib/codeless_code/commands/list_translations.rb

Overview

List all the translations available in the given CodelessCode::Catalog.

Instance Method Summary collapse

Constructor Details

#initialize(catalog, io: nil) ⇒ ListTranslations

Returns a new instance of ListTranslations

Parameters:

  • io (IO)

    if given, the output will be written to this stream, otherwise STDOUT will be used


24
25
26
27
# File 'lib/codeless_code/commands/list_translations.rb', line 24

def initialize(catalog, io: nil)
  @catalog = catalog
  @io = io
end

Instance Method Details

#callObject


29
30
31
32
33
34
# File 'lib/codeless_code/commands/list_translations.rb', line 29

def call
  @catalog.language_sets.each do |set|
    translators = set.fable_sets.map(&:translator).sort
    puts format('%s  %s', set.lang, translators.join(', '))
  end
end