Class: Icapps::Translations::Import::Base
- Inherits:
-
Object
- Object
- Icapps::Translations::Import::Base
- Defined in:
- lib/icapps/translations/import/base.rb
Class Method Summary collapse
- .config ⇒ Object
- .fetch_languages ⇒ Object
- .import ⇒ Object
- .options ⇒ Object
- .write_to_file(content, files, language) ⇒ Object
Class Method Details
.config ⇒ Object
24 25 26 |
# File 'lib/icapps/translations/import/base.rb', line 24 def config ::Icapps::Translations.config end |
.fetch_languages ⇒ Object
28 29 30 |
# File 'lib/icapps/translations/import/base.rb', line 28 def fetch_languages ::Icapps::Translations::Http.authenticated_response('languages.json', true) end |
.import ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/icapps/translations/import/base.rb', line 10 def import puts "[VERBOSE] Importing translations from project with key #{.project_key}".colorize(:white) if [:verbose] languages_json = fetch_languages puts "[VERBOSE] There are currently #{languages_json.count} language(s) for this project.".colorize(:white) if [:verbose] languages_json.each { |language| fetch_language_file language } puts '[MESSAGE] Finished importing translation.'.colorize(:green) end |
.options ⇒ Object
20 21 22 |
# File 'lib/icapps/translations/import/base.rb', line 20 def ::Icapps::Translations. end |
.write_to_file(content, files, language) ⇒ Object
32 33 34 35 |
# File 'lib/icapps/translations/import/base.rb', line 32 def write_to_file(content, files, language) File.open(files.first, 'w+') { |file| file.puts content } puts "[VERBOSE] Written #{language['short_name']} translations to #{files.first}.".colorize(:green) if [:verbose] end |