Class: Icapps::Translations::Import::Gradle
- Defined in:
- lib/icapps/translations/import/gradle.rb
Class Method Summary collapse
Methods inherited from Base
config, fetch_languages, import, options, write_to_file
Class Method Details
.fetch_language_file(language) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/icapps/translations/import/gradle.rb', line 11 def fetch_language_file(language) short_name = language['short_name'] puts "[VERBOSE] Fetching #{short_name} translations.".colorize(:white) if [:verbose] file_path = "app/src/main/res/#{values_name(short_name)}/#{config.filename}" xml_files = Dir.glob(file_path) if xml_files.count == 0 puts "[WARNING] No '#{file_path}' file found for the #{short_name} language.".colorize(:yellow) elsif xml_files.count > 1 puts "[WARNING] Multiple '#{file_path}' files found for the #{short_name} language.".colorize(:yellow) else xml = ::Icapps::Translations::Http.authenticated_response("translations/#{language['id']}.xml") write_to_file xml, xml_files, language end end |