crowdin-api 0.0.9 → 0.0.10

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.
data/README.md CHANGED
@@ -42,16 +42,16 @@ Documentation: <http://crowdin.net/page/api/add-file>.
42
42
 
43
43
  First parameter is array of files that should be added to Crowdin project.
44
44
  Every file is hash:
45
- * `:dest` - file name with path in Crowdin project (_required_)
46
- * `:source` - uploaded file (_required_)
47
- * `:title` - title for uploaded file (_optional_)
48
- * `:export_pattern` - string that defines name of resulted file (_optional_)
45
+ * `:dest` - file name with path in Crowdin project (required)
46
+ * `:source` - uploaded file (required)
47
+ * `:title` - title for uploaded file (optional)
48
+ * `:export_pattern` - string that defines name of resulted file (optional)
49
49
 
50
50
 
51
51
  ```ruby
52
52
  crowdin.add_file(
53
53
  files = [
54
- { :dest => '/directory/array.xml', :source => 'array.xml', :export_pattern => '/values-%two_letter_code%/%original_file_name%' },
54
+ { :dest => '/directory/array.xml', :source => 'array.xml', :export_pattern => '/values-%two_letters_code%/%original_file_name%' },
55
55
  { :dest => 'strings.xml', :source => 'strings.xml', :title => 'Texts in Application' }
56
56
  ], :type => 'android')
57
57
  ```
@@ -62,15 +62,15 @@ Documentation <http://crowdin.net/page/api/update-file>
62
62
 
63
63
  First parameter is array of files that should be updated in Crowdin project.
64
64
  Every file is hash:
65
- * `:dest` - file name with path in Crowdin project (_required_)
66
- * `:source` - uploaded file (_required_)
67
- * `:title` - title for uploaded file (_optional_)
68
- * `:export_pattern` - string that defines name of resulted file (_optional_)
65
+ * `:dest` - file name with path in Crowdin project (required)
66
+ * `:source` - uploaded file (required)
67
+ * `:title` - title for uploaded file (optional)
68
+ * `:export_pattern` - string that defines name of resulted file (optional)
69
69
 
70
70
  ```ruby
71
71
  crowdin.update_file(
72
72
  files = [
73
- { :dest => '/directory/array.xml', :source => 'array.xml', :export_pattern => '/values-%two_letter_code%/%original_file_name%'},
73
+ { :dest => '/directory/array.xml', :source => 'array.xml', :export_pattern => '/values-%two_letters_code%/%original_file_name%'},
74
74
  { :dest => 'strings.xml', :source => 'strings.xml' }
75
75
  ])
76
76
 
@@ -88,6 +88,31 @@ crowdin.delete_file('strings.xml')
88
88
 
89
89
  Documentation: <http://crowdin.net/page/api/upload-translation>
90
90
 
91
+ First parameter is array of translated files that should be added to Crowdin project.
92
+ Every file is hash:
93
+ * `:dest` - file names in Crowdin (required)
94
+ * `:source` - uploaded translation (required)
95
+
96
+ Second parameter is target language.
97
+ With a single call it's possible to upload translations for several files but only into one of the languages.
98
+ Check [complete list of Crowdin language codes](http://crowdin.net/page/api/language-codes) that can be used.
99
+
100
+ Optional params:
101
+ * `:import_duplicates` - defines whether to add translation if there is the same translation previously added (default: false)
102
+ * `:import_eq_suggestions` - defines whether to add translation if it is equal to source string at Crowdin (default: false)
103
+ * `:auto_approve_imported` - mark uploaded translations as approved (default: false)
104
+
105
+ ```ruby
106
+ crowdin.upload_translation(
107
+ files = [
108
+ { :dest => 'strings.xml', :source => 'strings_uk.xml' },
109
+ { :dest => 'array.xml', :source => 'array_uk.xml' }
110
+ ],
111
+ language = 'uk',
112
+ params = {:import_duplicates => true}
113
+ )
114
+ ```
115
+
91
116
  ### Translation Status
92
117
 
93
118
  Documentation: <http://crowdin.net/page/api/status>
@@ -170,6 +195,10 @@ Tested with the following Ruby versions:
170
195
  4. Push to the branch (`git push origin my-new-feature`)
171
196
  5. Create new Pull Request
172
197
 
173
- ## License
198
+ ## License and Author
199
+
200
+ Author: Anton Maminov (anton.maminov@gmail.com)
201
+
202
+ Copyright: 2012 [Crowdin.net](http://crowdin.net/)
174
203
 
175
204
  This library is distributed under the MIT license. Please see the LICENSE file.
@@ -1,18 +1,19 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- crowdin-api (0.0.8)
4
+ crowdin-api (0.0.10)
5
5
  rest-client
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- mime-types (1.19)
10
+ mime-types (1.20.1)
11
11
  rest-client (1.6.7)
12
12
  mime-types (>= 1.16)
13
13
 
14
14
  PLATFORMS
15
15
  java
16
+ ruby
16
17
 
17
18
  DEPENDENCIES
18
19
  crowdin-api!
@@ -16,3 +16,7 @@ crowdin = Crowdin::API.new(:api_key => API_KEY, :project_id => PROJECT_ID)
16
16
  crowdin.log = Logger.new $stderr
17
17
 
18
18
  pp crowdin.project_info
19
+
20
+ #file = { :dest => '/arrays.xml', :source => 'arrays.xml', :export_pattern => '/values-%three_letters_code%/%original_file_name%' }
21
+ #crowdin.add_file([] << file)
22
+ #crowdin.update_file([] << file)
@@ -34,7 +34,7 @@ module Crowdin
34
34
  params[:export_patterns] = Hash[files.map{ |f| [f[:dest], f[:export_pattern]] }]
35
35
  params[:export_patterns].delete_if{ |k, v| v.nil? }
36
36
 
37
- params.delete_if{ |k, v| v.empty? }
37
+ params.delete_if{ |k, v| v.to_s.empty? }
38
38
 
39
39
  request(
40
40
  :method => :post,
@@ -1,5 +1,5 @@
1
1
  module Crowdin
2
2
  class API
3
- VERSION = "0.0.9"
3
+ VERSION = "0.0.10"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crowdin-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-19 00:00:00.000000000 Z
12
+ date: 2013-02-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -36,7 +36,6 @@ extensions: []
36
36
  extra_rdoc_files: []
37
37
  files:
38
38
  - Gemfile
39
- - Gemfile.lock
40
39
  - LICENSE
41
40
  - README.md
42
41
  - Rakefile
@@ -68,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
67
  version: '0'
69
68
  requirements: []
70
69
  rubyforge_project:
71
- rubygems_version: 1.8.23
70
+ rubygems_version: 1.8.25
72
71
  signing_key:
73
72
  specification_version: 3
74
73
  summary: The Crowdin Ruby Client is used to interact with the Crowdin API from Ruby
data/Gemfile.lock DELETED
@@ -1,12 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- mime-types (1.19)
5
- rest-client (1.6.7)
6
- mime-types (>= 1.16)
7
-
8
- PLATFORMS
9
- ruby
10
-
11
- DEPENDENCIES
12
- rest-client