phraseapp_android 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.gitignore +10 -0
 - data/.rspec +2 -0
 - data/.travis.yml +4 -0
 - data/CODE_OF_CONDUCT.md +13 -0
 - data/Gemfile +4 -0
 - data/LICENSE +20 -0
 - data/README.md +30 -0
 - data/Rakefile +6 -0
 - data/bin/console +14 -0
 - data/bin/phrase_app_translations +42 -0
 - data/bin/setup +7 -0
 - data/lib/phraseapp_android/file_formatter.rb +68 -0
 - data/lib/phraseapp_android/format_check.rb +51 -0
 - data/lib/phraseapp_android/missing_translations.rb +107 -0
 - data/lib/phraseapp_android/phrase_app_client.rb +59 -0
 - data/lib/phraseapp_android/upload.rb +39 -0
 - data/lib/phraseapp_android/version.rb +3 -0
 - data/lib/phraseapp_android.rb +10 -0
 - data/phraseapp_android.gemspec +29 -0
 - metadata +149 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: f1bfba10c4b6cbe4cdcebe6b43238b0f5831aee6
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 04b26134b3a91b71167c0faca54154e1e023caaa
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 57e1cf5c6bebf15704a1814ead25ee5892a07a9d5d95dfe8487c804aebda8f9925ba80b2c9588676aabd849197bb01c7d8d7768f338d94112c128e4929117f3d
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: ccc4b1ea8f4eff82714bd367e4dccdaa38ab976e646e41bf4b7885f28af456e34f022d53a28d18c5d8701c6ef6c023d984bf1ecf86b99fa227ef29986c51a0af
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/.rspec
    ADDED
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/CODE_OF_CONDUCT.md
    ADDED
    
    | 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Contributor Code of Conduct
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
         
     | 
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            The MIT License (MIT)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2015 Anjlab
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy of
         
     | 
| 
      
 6 
     | 
    
         
            +
            this software and associated documentation files (the "Software"), to deal in
         
     | 
| 
      
 7 
     | 
    
         
            +
            the Software without restriction, including without limitation the rights to
         
     | 
| 
      
 8 
     | 
    
         
            +
            use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
         
     | 
| 
      
 9 
     | 
    
         
            +
            the Software, and to permit persons to whom the Software is furnished to do so,
         
     | 
| 
      
 10 
     | 
    
         
            +
            subject to the following conditions:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in all
         
     | 
| 
      
 13 
     | 
    
         
            +
            copies or substantial portions of the Software.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 16 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
         
     | 
| 
      
 17 
     | 
    
         
            +
            FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
         
     | 
| 
      
 18 
     | 
    
         
            +
            COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
         
     | 
| 
      
 19 
     | 
    
         
            +
            IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
         
     | 
| 
      
 20 
     | 
    
         
            +
            CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # PhraseappAndroid
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            This gem is intended to make managing PhraseApp translations in Android projects much easier.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                $ gem install phraseapp_android
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                $ ./phrase_app_translations COMMAND
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            Commands:
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                list_missing        List missing translations
         
     | 
| 
      
 16 
     | 
    
         
            +
                pull                Download translations from PhraseApp
         
     | 
| 
      
 17 
     | 
    
         
            +
                push                Upload translations to PhraseApp
         
     | 
| 
      
 18 
     | 
    
         
            +
                reformat            Sort translations texts alphabetically in local files
         
     | 
| 
      
 19 
     | 
    
         
            +
                check_formatting    Check formatting arguments in local files
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            ## Development
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            Bug reports and pull requests are welcome on GitHub at https://github.com/anjlab/phraseapp_android. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
    
        data/Rakefile
    ADDED
    
    
    
        data/bin/console
    ADDED
    
    | 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'bundler/setup'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'phraseapp_android'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # You can add fixtures and/or initialization code here to make experimenting
         
     | 
| 
      
 7 
     | 
    
         
            +
            # with your gem easier. You can also use a different console, if you like.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            # (If you use this, don't forget to add pry to your Gemfile!)
         
     | 
| 
      
 10 
     | 
    
         
            +
            # require "pry"
         
     | 
| 
      
 11 
     | 
    
         
            +
            # Pry.start
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            require 'irb'
         
     | 
| 
      
 14 
     | 
    
         
            +
            IRB.start
         
     | 
| 
         @@ -0,0 +1,42 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'phraseapp_android'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            unless ENV['PHRASE_ACCESS_TOKEN']
         
     | 
| 
      
 5 
     | 
    
         
            +
              puts 'you have\'nt set PHRASE_ACCESS_TOKEN environment variable! You can create access token at https://phraseapp.com/settings/oauth_access_tokens'.red
         
     | 
| 
      
 6 
     | 
    
         
            +
              exit 1
         
     | 
| 
      
 7 
     | 
    
         
            +
            end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            unless ENV['PHRASE_PROJECT_ID']
         
     | 
| 
      
 10 
     | 
    
         
            +
              puts 'you have\'nt set PHRASE_PROJECT_ID environment variable! You find your Project Id at https://phraseapp.com/projects'.red
         
     | 
| 
      
 11 
     | 
    
         
            +
              exit 1
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            if ARGV.empty?
         
     | 
| 
      
 15 
     | 
    
         
            +
              puts <<END_TEXT
         
     | 
| 
      
 16 
     | 
    
         
            +
            Usage phrase_app_translations COMMAND
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            Manage Android project localization data with PhraseApp
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            Commands:
         
     | 
| 
      
 21 
     | 
    
         
            +
              list_missing        List missing translations
         
     | 
| 
      
 22 
     | 
    
         
            +
              pull                Download translations from PhraseApp
         
     | 
| 
      
 23 
     | 
    
         
            +
              push                Upload translations to PhraseApp
         
     | 
| 
      
 24 
     | 
    
         
            +
              reformat            Sort translations texts alphabetically in local files
         
     | 
| 
      
 25 
     | 
    
         
            +
              check_formatting    Check formatting arguments in local files
         
     | 
| 
      
 26 
     | 
    
         
            +
            END_TEXT
         
     | 
| 
      
 27 
     | 
    
         
            +
            else
         
     | 
| 
      
 28 
     | 
    
         
            +
              case ARGV[0].downcase
         
     | 
| 
      
 29 
     | 
    
         
            +
                when 'list_missing'
         
     | 
| 
      
 30 
     | 
    
         
            +
                  PhraseApp::Android::MissingTranslations.new.list
         
     | 
| 
      
 31 
     | 
    
         
            +
                when 'pull'
         
     | 
| 
      
 32 
     | 
    
         
            +
                  PhraseApp::Android::MissingTranslations.new.pull
         
     | 
| 
      
 33 
     | 
    
         
            +
                when 'push'
         
     | 
| 
      
 34 
     | 
    
         
            +
                  PhraseApp::Android::Upload.new.perform ARGV[1] || 'en'
         
     | 
| 
      
 35 
     | 
    
         
            +
                when 'reformat'
         
     | 
| 
      
 36 
     | 
    
         
            +
                  PhraseApp::Android::FileFormatter.new.apply_to_all_files
         
     | 
| 
      
 37 
     | 
    
         
            +
                when 'check_formatting'
         
     | 
| 
      
 38 
     | 
    
         
            +
                  PhraseApp::Android::FormatCheck.new.perform
         
     | 
| 
      
 39 
     | 
    
         
            +
                else
         
     | 
| 
      
 40 
     | 
    
         
            +
                  puts 'Unknown command!'.red
         
     | 
| 
      
 41 
     | 
    
         
            +
              end
         
     | 
| 
      
 42 
     | 
    
         
            +
            end
         
     | 
    
        data/bin/setup
    ADDED
    
    
| 
         @@ -0,0 +1,68 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative './phrase_app_client'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class PhraseApp::Android::FileFormatter < PhraseApp::Android::PhraseAppClient
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              def apply(file_name, locale)
         
     | 
| 
      
 6 
     | 
    
         
            +
                doc = read_locale_file file_name, locale
         
     | 
| 
      
 7 
     | 
    
         
            +
                formatted = apply_to_xml_doc doc
         
     | 
| 
      
 8 
     | 
    
         
            +
                File.write locale_file_name(file_name, locale), formatted
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              def apply_to_xml_doc(doc)
         
     | 
| 
      
 12 
     | 
    
         
            +
                data = {}
         
     | 
| 
      
 13 
     | 
    
         
            +
                ignore_keys = []
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                match_elements doc, 'integer-array', data, ignore_keys
         
     | 
| 
      
 16 
     | 
    
         
            +
                match_elements doc, 'string-array', data, ignore_keys
         
     | 
| 
      
 17 
     | 
    
         
            +
                match_elements doc, 'string', data, ignore_keys
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                last_name = nil
         
     | 
| 
      
 20 
     | 
    
         
            +
                builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
         
     | 
| 
      
 21 
     | 
    
         
            +
                  xml.resources('xmlns:tools' => 'http://schemas.android.com/tools') do
         
     | 
| 
      
 22 
     | 
    
         
            +
                    data.keys.sort.each do |k|
         
     | 
| 
      
 23 
     | 
    
         
            +
                      name = k.split('_').first.to_s
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                      if last_name != name
         
     | 
| 
      
 26 
     | 
    
         
            +
                        xml.comment " #{name} * "
         
     | 
| 
      
 27 
     | 
    
         
            +
                        last_name = name
         
     | 
| 
      
 28 
     | 
    
         
            +
                      end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                      attrs = {name: k}
         
     | 
| 
      
 31 
     | 
    
         
            +
                      attrs['tools:ignore'] = 'MissingTranslation' if ignore_keys.include? k
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                      xml.send data[k][:name], attrs do
         
     | 
| 
      
 34 
     | 
    
         
            +
                        if data[k][:name].end_with?('array')
         
     | 
| 
      
 35 
     | 
    
         
            +
                          data[k][:value].each do |t|
         
     | 
| 
      
 36 
     | 
    
         
            +
                            xml.item t
         
     | 
| 
      
 37 
     | 
    
         
            +
                          end
         
     | 
| 
      
 38 
     | 
    
         
            +
                        else
         
     | 
| 
      
 39 
     | 
    
         
            +
                          xml.text data[k][:value]
         
     | 
| 
      
 40 
     | 
    
         
            +
                        end
         
     | 
| 
      
 41 
     | 
    
         
            +
                      end
         
     | 
| 
      
 42 
     | 
    
         
            +
                    end
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                builder.to_xml indent: 4
         
     | 
| 
      
 47 
     | 
    
         
            +
              end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
              def apply_to_all_files
         
     | 
| 
      
 50 
     | 
    
         
            +
                count = 0
         
     | 
| 
      
 51 
     | 
    
         
            +
                ([nil] + locales).each do |locale|
         
     | 
| 
      
 52 
     | 
    
         
            +
                  apply 'strings', locale
         
     | 
| 
      
 53 
     | 
    
         
            +
                  apply 'arrays', locale
         
     | 
| 
      
 54 
     | 
    
         
            +
                  count += 2
         
     | 
| 
      
 55 
     | 
    
         
            +
                end
         
     | 
| 
      
 56 
     | 
    
         
            +
                puts "#{count} files were reformatted.".green
         
     | 
| 
      
 57 
     | 
    
         
            +
              end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
              private
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
              def match_elements(doc, node_name, data, ignore_keys)
         
     | 
| 
      
 62 
     | 
    
         
            +
                doc.at('//resources').search(node_name).each do |string|
         
     | 
| 
      
 63 
     | 
    
         
            +
                  data[string.attr('name')] = {name: string.name, value: node_name.end_with?('array') ? string.search('item').map(&:text) : string.text}
         
     | 
| 
      
 64 
     | 
    
         
            +
                  ignore_keys << string.attr('name') if string.attr('tools:ignore')
         
     | 
| 
      
 65 
     | 
    
         
            +
                end
         
     | 
| 
      
 66 
     | 
    
         
            +
              end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,51 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative './phrase_app_client'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class PhraseApp::Android::FormatCheck < PhraseApp::Android::PhraseAppClient
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              attr_accessor :keys
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              def initialize(options = {})
         
     | 
| 
      
 8 
     | 
    
         
            +
                super(options)
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                self.keys = xml_strings_to_hash 'strings', nil
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              def perform
         
     | 
| 
      
 14 
     | 
    
         
            +
                locales.map { |l| perform_for_locale(l) }.reduce(:+)
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              def perform_for_locale(locale)
         
     | 
| 
      
 18 
     | 
    
         
            +
                data = xml_strings_to_hash 'strings', locale
         
     | 
| 
      
 19 
     | 
    
         
            +
                count = 0
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                keys.each do |name, value|
         
     | 
| 
      
 22 
     | 
    
         
            +
                  formatters = value.scan /(%[\d$a-z]+)/i
         
     | 
| 
      
 23 
     | 
    
         
            +
                  count += 1 if formatters && !check_formatters(locale, data, name, formatters)
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                count
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              private
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
              def xml_strings_to_hash(file_name, locale)
         
     | 
| 
      
 32 
     | 
    
         
            +
                string_keys = {}
         
     | 
| 
      
 33 
     | 
    
         
            +
                read_locale_file(file_name, locale).at('//resources').search('string').each do |string|
         
     | 
| 
      
 34 
     | 
    
         
            +
                  string_keys[string.attr('name')] = string.text
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
                string_keys
         
     | 
| 
      
 37 
     | 
    
         
            +
              end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
              def check_formatters(locale, locale_data, name, sample_formatters)
         
     | 
| 
      
 40 
     | 
    
         
            +
                localized_key = locale_data[name]
         
     | 
| 
      
 41 
     | 
    
         
            +
                if localized_key
         
     | 
| 
      
 42 
     | 
    
         
            +
                  sw_formatters = localized_key.scan /(%[\d$a-z]+)/i
         
     | 
| 
      
 43 
     | 
    
         
            +
                  if sample_formatters.sort != sw_formatters.sort
         
     | 
| 
      
 44 
     | 
    
         
            +
                    puts ('%s: Arguments mismatch for %s' % [locale, name]).red
         
     | 
| 
      
 45 
     | 
    
         
            +
                    return false
         
     | 
| 
      
 46 
     | 
    
         
            +
                  end
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
                true
         
     | 
| 
      
 49 
     | 
    
         
            +
              end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,107 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative './phrase_app_client'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class PhraseApp::Android::MissingTranslations < PhraseApp::Android::PhraseAppClient
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              def list
         
     | 
| 
      
 6 
     | 
    
         
            +
                count = 0
         
     | 
| 
      
 7 
     | 
    
         
            +
                locales.each do |locale|
         
     | 
| 
      
 8 
     | 
    
         
            +
                  missing = find locale
         
     | 
| 
      
 9 
     | 
    
         
            +
                  if missing.size > 0
         
     | 
| 
      
 10 
     | 
    
         
            +
                    puts "Missing translations for #{locale.upcase} locale:".red
         
     | 
| 
      
 11 
     | 
    
         
            +
                    missing.each { |s| puts s.to_s.yellow }
         
     | 
| 
      
 12 
     | 
    
         
            +
                    count += missing.size
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
                puts 'No missing translations found.'.green if count == 0
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              def find(locale)
         
     | 
| 
      
 19 
     | 
    
         
            +
                list = []
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                default_strings, default_arrays = load_locale_files nil
         
     | 
| 
      
 22 
     | 
    
         
            +
                localized_strings, localized_arrays = load_locale_files locale
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                default_strings.each do |name, el|
         
     | 
| 
      
 25 
     | 
    
         
            +
                  list << el unless localized_strings.has_key?(name)
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                default_arrays.each do |name, el|
         
     | 
| 
      
 29 
     | 
    
         
            +
                  list << el if !localized_arrays.has_key?(name) || el.search('item').size != localized_arrays[name].search('item').size
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                list
         
     | 
| 
      
 33 
     | 
    
         
            +
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              def pull
         
     | 
| 
      
 36 
     | 
    
         
            +
                locales.each do |locale|
         
     | 
| 
      
 37 
     | 
    
         
            +
                  pull_locale locale
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
              end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
              def pull_locale(locale)
         
     | 
| 
      
 42 
     | 
    
         
            +
                strings_updated = 0
         
     | 
| 
      
 43 
     | 
    
         
            +
                arrays_updated = 0
         
     | 
| 
      
 44 
     | 
    
         
            +
                missing = find locale
         
     | 
| 
      
 45 
     | 
    
         
            +
                if missing.size > 0
         
     | 
| 
      
 46 
     | 
    
         
            +
                  strings = read_locale_file 'strings', locale
         
     | 
| 
      
 47 
     | 
    
         
            +
                  arrays = read_locale_file 'arrays', locale
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  params = PhraseApp::RequestParams::LocaleDownloadParams.new file_format: 'xml'
         
     | 
| 
      
 50 
     | 
    
         
            +
                  doc = Nokogiri::XML client.locale_download(project_id, locale, params)
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                  missing.each do |el|
         
     | 
| 
      
 53 
     | 
    
         
            +
                    name = el.attr 'name'
         
     | 
| 
      
 54 
     | 
    
         
            +
                    translated = doc.at('//resources').search("#{el.name}[@name=#{name}]").first
         
     | 
| 
      
 55 
     | 
    
         
            +
                    if translated
         
     | 
| 
      
 56 
     | 
    
         
            +
                      if el.name == 'string'
         
     | 
| 
      
 57 
     | 
    
         
            +
                        str = Nokogiri::XML::Node.new 'string', strings
         
     | 
| 
      
 58 
     | 
    
         
            +
                        str['name'] = name
         
     | 
| 
      
 59 
     | 
    
         
            +
                        str.content = translated.text
         
     | 
| 
      
 60 
     | 
    
         
            +
                        strings.at('//resources').children.last.after str
         
     | 
| 
      
 61 
     | 
    
         
            +
                        strings_updated += 1
         
     | 
| 
      
 62 
     | 
    
         
            +
                      elsif el.name == 'string-array'
         
     | 
| 
      
 63 
     | 
    
         
            +
                        str = Nokogiri::XML::Node.new 'string-array', arrays
         
     | 
| 
      
 64 
     | 
    
         
            +
                        str['name'] = name
         
     | 
| 
      
 65 
     | 
    
         
            +
                        translated.element_children.each do |child|
         
     | 
| 
      
 66 
     | 
    
         
            +
                          item = Nokogiri::XML::Node.new 'item', arrays
         
     | 
| 
      
 67 
     | 
    
         
            +
                          item.content = child.text
         
     | 
| 
      
 68 
     | 
    
         
            +
                          str.add_child item
         
     | 
| 
      
 69 
     | 
    
         
            +
                        end
         
     | 
| 
      
 70 
     | 
    
         
            +
                        arrays.at('//resources').children.last.after str
         
     | 
| 
      
 71 
     | 
    
         
            +
                        arrays_updated += 1
         
     | 
| 
      
 72 
     | 
    
         
            +
                      end
         
     | 
| 
      
 73 
     | 
    
         
            +
                    end
         
     | 
| 
      
 74 
     | 
    
         
            +
                  end
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                  if strings_updated + arrays_updated > 0
         
     | 
| 
      
 77 
     | 
    
         
            +
                    PhraseApp::Android::FileFormatter.new.apply('strings', locale) if strings_updated > 0
         
     | 
| 
      
 78 
     | 
    
         
            +
                    PhraseApp::Android::FileFormatter.new.apply('arrays', locale) if arrays_updated > 0
         
     | 
| 
      
 79 
     | 
    
         
            +
                    puts "#{strings_updated + arrays_updated} translation keys were updated.".green
         
     | 
| 
      
 80 
     | 
    
         
            +
                  else
         
     | 
| 
      
 81 
     | 
    
         
            +
                    puts 'no keys were updated.'.yellow
         
     | 
| 
      
 82 
     | 
    
         
            +
                  end
         
     | 
| 
      
 83 
     | 
    
         
            +
                end
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
                [strings_updated, arrays_updated]
         
     | 
| 
      
 86 
     | 
    
         
            +
              end
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
              private
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
              def load_locale_files(locale)
         
     | 
| 
      
 91 
     | 
    
         
            +
                strings = {}
         
     | 
| 
      
 92 
     | 
    
         
            +
                arrays = {}
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
                %w(strings arrays).each do |file|
         
     | 
| 
      
 95 
     | 
    
         
            +
                  doc = read_locale_file(file, locale).at('//resources')
         
     | 
| 
      
 96 
     | 
    
         
            +
                  doc.search('string').each do |str|
         
     | 
| 
      
 97 
     | 
    
         
            +
                    strings[str.attr('name')] = str unless str.attr('tools:ignore')
         
     | 
| 
      
 98 
     | 
    
         
            +
                  end
         
     | 
| 
      
 99 
     | 
    
         
            +
                  doc.search('string-array').each do |array|
         
     | 
| 
      
 100 
     | 
    
         
            +
                    arrays[array.attr('name')] = array unless array.attr('tools:ignore')
         
     | 
| 
      
 101 
     | 
    
         
            +
                  end
         
     | 
| 
      
 102 
     | 
    
         
            +
                end
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
                [strings, arrays]
         
     | 
| 
      
 105 
     | 
    
         
            +
              end
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,59 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'phraseapp-ruby'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'nokogiri'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'colorize'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module PhraseApp
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              module Android
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                class PhraseAppClient
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  attr_accessor :client, :project_id, :locale_files, :locales, :sub_path
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  def initialize(options = {})
         
     | 
| 
      
 14 
     | 
    
         
            +
                    credentials = PhraseApp::Auth::Credentials.new token: (options[:token] || ENV['PHRASE_ACCESS_TOKEN'])
         
     | 
| 
      
 15 
     | 
    
         
            +
                    self.client = PhraseApp::Client.new credentials
         
     | 
| 
      
 16 
     | 
    
         
            +
                    self.project_id = options[:project_id] || ENV['PHRASE_PROJECT_ID']
         
     | 
| 
      
 17 
     | 
    
         
            +
                    self.sub_path = options[:path]
         
     | 
| 
      
 18 
     | 
    
         
            +
                    find_locales
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  def read_xml_file(file_name)
         
     | 
| 
      
 22 
     | 
    
         
            +
                    if file_name
         
     | 
| 
      
 23 
     | 
    
         
            +
                      f = File.open file_name
         
     | 
| 
      
 24 
     | 
    
         
            +
                      doc = Nokogiri::XML f
         
     | 
| 
      
 25 
     | 
    
         
            +
                      f.close
         
     | 
| 
      
 26 
     | 
    
         
            +
                      doc
         
     | 
| 
      
 27 
     | 
    
         
            +
                    end
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  def read_locale_file(file_name, locale)
         
     | 
| 
      
 31 
     | 
    
         
            +
                    read_xml_file locale_file_name(file_name, locale)
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  def locale_file_name(file_name, locale)
         
     | 
| 
      
 35 
     | 
    
         
            +
                    locale = '-' + locale unless locale.nil?
         
     | 
| 
      
 36 
     | 
    
         
            +
                    locale_files.find { |f| f.end_with?("values#{locale}/#{file_name}.xml") }
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                  protected
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                  def find_locales
         
     | 
| 
      
 42 
     | 
    
         
            +
                    self.locale_files = Dir.glob("#{sub_path}**/main/res/values*/{strings,arrays}.xml")
         
     | 
| 
      
 43 
     | 
    
         
            +
                    self.locales = locale_files
         
     | 
| 
      
 44 
     | 
    
         
            +
                                       .map { |file| file.match(/res\/values[-]*([a-z]+)?\//i)[1] }
         
     | 
| 
      
 45 
     | 
    
         
            +
                                       .compact
         
     | 
| 
      
 46 
     | 
    
         
            +
                                       .uniq
         
     | 
| 
      
 47 
     | 
    
         
            +
                  end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  def write_xml_to_file(path, doc)
         
     | 
| 
      
 50 
     | 
    
         
            +
                    File.open path, 'w' do |f|
         
     | 
| 
      
 51 
     | 
    
         
            +
                      f.write doc.to_xml(ident: 4)
         
     | 
| 
      
 52 
     | 
    
         
            +
                    end
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
              end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,39 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative './phrase_app_client'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'tempfile'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            class PhraseApp::Android::Upload < PhraseApp::Android::PhraseAppClient
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              def perform(locale = 'en')
         
     | 
| 
      
 7 
     | 
    
         
            +
                file = build_upload_file
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                params = PhraseApp::RequestParams::UploadParams.new file: file.path, file_format: 'xml', locale_id: locale
         
     | 
| 
      
 10 
     | 
    
         
            +
                upload = client.upload_create project_id, params
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                puts 'Successfully uploaded.'.green
         
     | 
| 
      
 13 
     | 
    
         
            +
                file.unlink
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                upload
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              def build_upload_file
         
     | 
| 
      
 19 
     | 
    
         
            +
                tmp = Tempfile.new %w(translations .xml)
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                doc = Nokogiri::XML::Document.new
         
     | 
| 
      
 22 
     | 
    
         
            +
                doc.encoding = 'utf-8'
         
     | 
| 
      
 23 
     | 
    
         
            +
                res = doc.create_element 'resources', 'xmlns:tools' => 'http://schemas.android.com/tools'
         
     | 
| 
      
 24 
     | 
    
         
            +
                doc.add_child res
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                locales.each do |locale|
         
     | 
| 
      
 27 
     | 
    
         
            +
                  %w(strings arrays).each do |file|
         
     | 
| 
      
 28 
     | 
    
         
            +
                    read_locale_file(file, locale).at('//resources').element_children.each do |el|
         
     | 
| 
      
 29 
     | 
    
         
            +
                      res.add_child(el) if el.attr('tools:ignore').nil?
         
     | 
| 
      
 30 
     | 
    
         
            +
                    end
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                tmp.write doc.to_xml(indent: 4)
         
     | 
| 
      
 35 
     | 
    
         
            +
                tmp.close
         
     | 
| 
      
 36 
     | 
    
         
            +
                tmp
         
     | 
| 
      
 37 
     | 
    
         
            +
              end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,10 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'phraseapp_android/version'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'phraseapp_android/format_check'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'phraseapp_android/upload'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'phraseapp_android/missing_translations'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'phraseapp_android/file_formatter'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'phraseapp_android/phrase_app_client'
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            module PhraseappAndroid
         
     | 
| 
      
 9 
     | 
    
         
            +
              # Your code goes here...
         
     | 
| 
      
 10 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,29 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'phraseapp_android/version'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.name          = 'phraseapp_android'
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.version       = PhraseappAndroid::VERSION
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.authors       = ['Sergey Glukhov (serggl)']
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.email         = ['sergey.glukhov@gmail.com']
         
     | 
| 
      
 11 
     | 
    
         
            +
              spec.license       = 'MIT'
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              spec.summary       = 'Manage Android localization data with PhraseApp'
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.description   = 'This gem is intended to make managing PhraseApp translations in Android projects much easier.'
         
     | 
| 
      
 15 
     | 
    
         
            +
              spec.homepage      = "https://github.com/anjlab/phraseapp_android"
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         
     | 
| 
      
 18 
     | 
    
         
            +
              spec.bindir        = 'bin'
         
     | 
| 
      
 19 
     | 
    
         
            +
              spec.executables   << 'phrase_app_translations'
         
     | 
| 
      
 20 
     | 
    
         
            +
              spec.require_paths = ['lib']
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              spec.add_development_dependency 'bundler', '~> 1.10'
         
     | 
| 
      
 23 
     | 
    
         
            +
              spec.add_development_dependency 'rake', '~> 10.0'
         
     | 
| 
      
 24 
     | 
    
         
            +
              spec.add_development_dependency 'rspec', '~> 3.0'
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              spec.add_runtime_dependency 'phraseapp-ruby', '~> 1.2'
         
     | 
| 
      
 27 
     | 
    
         
            +
              spec.add_runtime_dependency 'nokogiri', '~> 1.6'
         
     | 
| 
      
 28 
     | 
    
         
            +
              spec.add_runtime_dependency 'colorize', '~> 0.7'
         
     | 
| 
      
 29 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,149 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: phraseapp_android
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Sergey Glukhov (serggl)
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-11-19 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '1.10'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '1.10'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '3.0'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '3.0'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: phraseapp-ruby
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '1.2'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '1.2'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: nokogiri
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '1.6'
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '1.6'
         
     | 
| 
      
 83 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 84 
     | 
    
         
            +
              name: colorize
         
     | 
| 
      
 85 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 86 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 87 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 88 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 89 
     | 
    
         
            +
                    version: '0.7'
         
     | 
| 
      
 90 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 91 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 92 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 93 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 94 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 95 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 96 
     | 
    
         
            +
                    version: '0.7'
         
     | 
| 
      
 97 
     | 
    
         
            +
            description: This gem is intended to make managing PhraseApp translations in Android
         
     | 
| 
      
 98 
     | 
    
         
            +
              projects much easier.
         
     | 
| 
      
 99 
     | 
    
         
            +
            email:
         
     | 
| 
      
 100 
     | 
    
         
            +
            - sergey.glukhov@gmail.com
         
     | 
| 
      
 101 
     | 
    
         
            +
            executables:
         
     | 
| 
      
 102 
     | 
    
         
            +
            - phrase_app_translations
         
     | 
| 
      
 103 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 104 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 105 
     | 
    
         
            +
            files:
         
     | 
| 
      
 106 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 107 
     | 
    
         
            +
            - ".rspec"
         
     | 
| 
      
 108 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
      
 109 
     | 
    
         
            +
            - CODE_OF_CONDUCT.md
         
     | 
| 
      
 110 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 111 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 112 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 113 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 114 
     | 
    
         
            +
            - bin/console
         
     | 
| 
      
 115 
     | 
    
         
            +
            - bin/phrase_app_translations
         
     | 
| 
      
 116 
     | 
    
         
            +
            - bin/setup
         
     | 
| 
      
 117 
     | 
    
         
            +
            - lib/phraseapp_android.rb
         
     | 
| 
      
 118 
     | 
    
         
            +
            - lib/phraseapp_android/file_formatter.rb
         
     | 
| 
      
 119 
     | 
    
         
            +
            - lib/phraseapp_android/format_check.rb
         
     | 
| 
      
 120 
     | 
    
         
            +
            - lib/phraseapp_android/missing_translations.rb
         
     | 
| 
      
 121 
     | 
    
         
            +
            - lib/phraseapp_android/phrase_app_client.rb
         
     | 
| 
      
 122 
     | 
    
         
            +
            - lib/phraseapp_android/upload.rb
         
     | 
| 
      
 123 
     | 
    
         
            +
            - lib/phraseapp_android/version.rb
         
     | 
| 
      
 124 
     | 
    
         
            +
            - phraseapp_android.gemspec
         
     | 
| 
      
 125 
     | 
    
         
            +
            homepage: https://github.com/anjlab/phraseapp_android
         
     | 
| 
      
 126 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 127 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 128 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 129 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 130 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 131 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 132 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 133 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 134 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 135 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 136 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 137 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 138 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 139 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 140 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 141 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 142 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 143 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 144 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 145 
     | 
    
         
            +
            rubygems_version: 2.4.8
         
     | 
| 
      
 146 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 147 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 148 
     | 
    
         
            +
            summary: Manage Android localization data with PhraseApp
         
     | 
| 
      
 149 
     | 
    
         
            +
            test_files: []
         
     |