crowdin-cli 0.1.0 → 0.1.1
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 +25 -6
- data/bin/crowdin-cli +10 -7
- data/lib/crowdin-cli/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -83,7 +83,7 @@ Also you can add and upload all directories mathing the pattern including all ne
|
|
83
83
|
|
84
84
|
Example configuration provided above has 'source' and 'translation' attributes containing standard wildcards (also known as globbing patterns) to make it easier to work with multiple files.
|
85
85
|
|
86
|
-
Here's patterns you can use:
|
86
|
+
Here's patterns you can use:
|
87
87
|
|
88
88
|
* `*` (asterisk)
|
89
89
|
|
@@ -134,7 +134,7 @@ files:
|
|
134
134
|
```
|
135
135
|
Mapping format is the following: `crowdin_language_code : code_use_use`.
|
136
136
|
|
137
|
-
Check [complete list of Crowdin language codes](http://crowdin.net/page/api/language-codes) that can be used for mapping.
|
137
|
+
Check [complete list of Crowdin language codes](http://crowdin.net/page/api/language-codes) that can be used for mapping.
|
138
138
|
|
139
139
|
You can also override language codes for other placeholders like `%android_code%`, `%locale%` etc...
|
140
140
|
|
@@ -169,7 +169,7 @@ base_url: http://api.crowdin.net
|
|
169
169
|
base_path: /path/to/your/project
|
170
170
|
|
171
171
|
files:
|
172
|
-
-
|
172
|
+
-
|
173
173
|
source: '/res/values/*.xml'
|
174
174
|
translation: '/res/values-%android_code%/%original_file_name%'
|
175
175
|
languages_mapping:
|
@@ -177,10 +177,29 @@ files:
|
|
177
177
|
# we need this mapping since Crowdin expects directories
|
178
178
|
# to be named like "values-uk-rUA"
|
179
179
|
# acording to specification instead of just "uk"
|
180
|
-
de: de
|
180
|
+
de: de
|
181
181
|
ru: ru
|
182
182
|
```
|
183
183
|
|
184
|
+
### Uploading CSV files via API
|
185
|
+
|
186
|
+
```
|
187
|
+
---
|
188
|
+
project_identifier: test
|
189
|
+
api_key: KeepTheAPIkeySecret
|
190
|
+
base_url: http://api.crowdin.net
|
191
|
+
base_path: /path/to/your/project
|
192
|
+
|
193
|
+
files:
|
194
|
+
-
|
195
|
+
source: '/*.csv'
|
196
|
+
translation: '%two_letters_code%/%original_file_name%'
|
197
|
+
# Defines whether first line should be imported or it contains columns headers
|
198
|
+
first_line_contains_header: true
|
199
|
+
# Used only when uploading CSV file to define data columns mapping.
|
200
|
+
scheme: "identifier,source_phrase,translation,context,max_length"
|
201
|
+
```
|
202
|
+
|
184
203
|
## Usage
|
185
204
|
|
186
205
|
When the configuration file is created you are ready to start using `crowdin-cli` to manage your localization resources and automate files synchronization.
|
@@ -234,6 +253,6 @@ Tested with the following Ruby versions:
|
|
234
253
|
|
235
254
|
Author: Anton Maminov (anton.maminov@gmail.com)
|
236
255
|
|
237
|
-
Copyright: 2012 [Crowdin.net](http://crowdin.net/)
|
256
|
+
Copyright: 2012-2013 [Crowdin.net](http://crowdin.net/)
|
238
257
|
|
239
|
-
This library is distributed under the MIT license. Please see the LICENSE file.
|
258
|
+
This library is distributed under the MIT license. Please see the LICENSE file.
|
data/bin/crowdin-cli
CHANGED
@@ -204,7 +204,13 @@ EOS
|
|
204
204
|
|
205
205
|
if File.exist?("#{@base_path}#{file['source']}")
|
206
206
|
dest_files << file['source']
|
207
|
+
|
207
208
|
local_file = { dest: file['source'], source: "#{@base_path}#{file['source']}", export_pattern: file['translation'] }
|
209
|
+
# Used only when uploading CSV file to define data columns mapping.
|
210
|
+
local_file.merge!({ sheme: file['scheme'] }) if file.has_key?('scheme')
|
211
|
+
local_file.merge!({ first_line_contains_header: file['first_line_contains_header'] }) if file.has_key?('first_line_contains_header')
|
212
|
+
|
213
|
+
local_files << local_file
|
208
214
|
else
|
209
215
|
Dir.glob("#{@base_path}#{file['source']}").each do |source|
|
210
216
|
dest = source.sub("#{@base_path}", '') # relative path in Crowdin
|
@@ -216,15 +222,12 @@ EOS
|
|
216
222
|
export_pattern = file['translation'].sub('**', diff)
|
217
223
|
|
218
224
|
local_file = { dest: dest, source: source, export_pattern: export_pattern }
|
219
|
-
|
225
|
+
local_file.merge!({ sheme: file['scheme'] }) if file.has_key?('scheme')
|
226
|
+
local_file.merge!({ first_line_contains_header: file['first_line_contains_header'] }) if file.has_key?('first_line_contains_header')
|
220
227
|
|
228
|
+
local_files << local_file
|
229
|
+
end
|
221
230
|
end # if
|
222
|
-
|
223
|
-
# Used only when uploading CSV file to define data columns mapping.
|
224
|
-
local_file.merge!({ sheme: file['scheme'] }) if file.has_key?('scheme')
|
225
|
-
local_file.merge!({ first_line_contains_header: file['first_line_contains_header'] }) if file.has_key?('first_line_contains_header')
|
226
|
-
|
227
|
-
local_files << local_file
|
228
231
|
end # @config['files']
|
229
232
|
|
230
233
|
if dest_files.empty?
|
data/lib/crowdin-cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crowdin-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
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: 2013-02-
|
12
|
+
date: 2013-02-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
144
|
rubyforge_project:
|
145
|
-
rubygems_version: 1.8.
|
145
|
+
rubygems_version: 1.8.24
|
146
146
|
signing_key:
|
147
147
|
specification_version: 3
|
148
148
|
summary: Crowdin CLI
|