Sha256: 8116ba246701e32cb2875c85a210cb8c47a583cf3ff10f931020d4f6f26205b9

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require 'colorize'

require 'icapps/translations/http'
require 'icapps/translations/import/base'

module Icapps
  module Translations
    module Import
      class Xcode < Base
        class << self
          def fetch_language_file(language)
            short_name = language['short_name']
            puts "[VERBOSE] Fetching #{short_name} translations.".colorize(:white) if options[:verbose]
            string_files = Dir.glob("**/#{short_name}.lproj/#{config.filename}")
            if string_files.count == 0
              puts "[WARNING] No 'Localizable.string' file found for the #{short_name} language.".colorize(:yellow)
            elsif string_files.count > 1
              puts "[WARNING] Multiple 'Localizable.string' files found for the #{short_name} language.".colorize(:yellow)
            else
              strings = ::Icapps::Translations::Http.authenticated_response("translations/#{language['id']}.strings")
              write_to_file strings, string_files, language
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
icapps-translations-0.2.1 lib/icapps/translations/import/xcode.rb