Class: TranslationIO::Client::BaseOperation::CreateNewMoFilesStep
- Inherits:
-
Object
- Object
- TranslationIO::Client::BaseOperation::CreateNewMoFilesStep
- Defined in:
- lib/translation_io/client/base_operation/create_new_mo_files_step.rb
Instance Method Summary collapse
-
#initialize(locales_path) ⇒ CreateNewMoFilesStep
constructor
A new instance of CreateNewMoFilesStep.
- #run ⇒ Object
Constructor Details
#initialize(locales_path) ⇒ CreateNewMoFilesStep
Returns a new instance of CreateNewMoFilesStep.
5 6 7 |
# File 'lib/translation_io/client/base_operation/create_new_mo_files_step.rb', line 5 def initialize(locales_path) @locales_path = locales_path end |
Instance Method Details
#run ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/translation_io/client/base_operation/create_new_mo_files_step.rb', line 9 def run TranslationIO.info "Creating new MO files." text_domain = TranslationIO.config.text_domain Dir["#{@locales_path}/*/#{text_domain}.po"].each do |po_path| mo_path = "#{File.dirname(po_path)}/LC_MESSAGES/#{text_domain}.mo" TranslationIO.info mo_path, 2, 2 FileUtils.mkdir_p(File.dirname(mo_path)) GetText::Tools::MsgFmt.run(po_path, '-o', mo_path) end end |