Class: AppLocale::FileWriter
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- AppLocale::FileWriter
- Defined in:
- lib/applocale/file_writer.rb
Instance Attribute Summary
Attributes inherited from BaseCommand
Instance Method Summary collapse
Methods inherited from BaseCommand
Constructor Details
This class inherits a constructor from AppLocale::BaseCommand
Instance Method Details
#call(response) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/applocale/file_writer.rb', line 5 def call(response) create_locale_directory unless File.directory?(config.locale_directory) relative_file_path = "#{config.locale_directory}/#{response.dig("language_code")}.yml" file_path = File.(relative_file_path) File.write(file_path, response.dig("yaml")) puts "[AppLocale] ↳ Wrote translations for #{response.dig("language_code")} to #{relative_file_path}" end |