web_translate_it 1.7.1.0 → 1.7.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/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009-2010 Atelier Convivialité
1
+ Copyright (c) 2009-2011 Atelier Convivialité
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person
4
4
  obtaining a copy of this software and associated documentation
data/bin/wti CHANGED
@@ -20,6 +20,11 @@ Choice.options do
20
20
  desc "Create and push a new master language file."
21
21
  end
22
22
 
23
+ option :addlocale do
24
+ long 'addlocale'
25
+ desc "Add a new locale to the project"
26
+ end
27
+
23
28
  option :server do
24
29
  long 'server'
25
30
  desc "Start a synchronisation server"
data/history.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## Version 1.7.1.1 / 2011-01-13
2
+
3
+ * New: `wti addlocale locale1 locale2 ...` to create new locales for a project.
4
+
1
5
  ## Version 1.7.1.0 / 2010-12-27
2
6
 
3
7
  * New: TranslationFile#fetch now use file timestamps served by the Project API.
@@ -51,6 +51,19 @@ module WebTranslateIt
51
51
  puts "Master file added. Use `wti push --all` to send your existing translations."
52
52
  end
53
53
 
54
+ def addlocale
55
+ STDOUT.sync = true
56
+ if parameters.nil?
57
+ puts "Usage: wti addlocale locale1 locale2 ..."
58
+ exit
59
+ end
60
+ parameters.each do |param|
61
+ print "Adding locale #{param}… "
62
+ puts WebTranslateIt::Project.create_locale(configuration.api_key, param)
63
+ end
64
+ puts "Done!"
65
+ end
66
+
54
67
  def autoconf
55
68
  puts "We will attempt to configure your project automagically"
56
69
  api_key = Util.ask("Please enter your project API Key")
@@ -6,7 +6,7 @@ module WebTranslateIt
6
6
  puts "Gathering project's information…"
7
7
  begin
8
8
  WebTranslateIt::Util.http_connection do |http|
9
- request = Net::HTTP::Get.new("/api/projects/#{api_key}.yaml")
9
+ request = Net::HTTP::Get.new("/api/projects/#{api_key}.yaml")
10
10
  Util.handle_response(http.request(request), true)
11
11
  end
12
12
  rescue Timeout::Error
@@ -19,7 +19,21 @@ module WebTranslateIt
19
19
  def self.fetch_stats(api_key)
20
20
  begin
21
21
  WebTranslateIt::Util.http_connection do |http|
22
- request = Net::HTTP::Get.new("/api/projects/#{api_key}/stats.yaml")
22
+ request = Net::HTTP::Get.new("/api/projects/#{api_key}/stats.yaml")
23
+ Util.handle_response(http.request(request), true)
24
+ end
25
+ rescue Timeout::Error
26
+ puts "The request timed out. The service may be overloaded. We will retry in 5 seconds."
27
+ sleep(5)
28
+ self.fetch_stats(api_key)
29
+ end
30
+ end
31
+
32
+ def self.create_locale(api_key, locale_code)
33
+ begin
34
+ WebTranslateIt::Util.http_connection do |http|
35
+ request = Net::HTTP::Post.new("/api/projects/#{api_key}/locales")
36
+ request.set_form_data({ 'id' => locale_code }, ';')
23
37
  Util.handle_response(http.request(request), true)
24
38
  end
25
39
  rescue Timeout::Error
data/version.yml CHANGED
@@ -2,4 +2,4 @@
2
2
  :major: 1
3
3
  :minor: 7
4
4
  :tiny: 1
5
- :patch: 0
5
+ :patch: 1
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_translate_it
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 97
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 7
8
9
  - 1
9
- - 0
10
- version: 1.7.1.0
10
+ - 1
11
+ version: 1.7.1.1
11
12
  platform: ruby
12
13
  authors:
13
14
  - "\xC3\x89douard Bri\xC3\xA8re"
@@ -15,7 +16,7 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-12-27 00:00:00 +01:00
19
+ date: 2011-01-13 00:00:00 +01:00
19
20
  default_executable: wti
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
@@ -26,6 +27,7 @@ dependencies:
26
27
  requirements:
27
28
  - - ~>
28
29
  - !ruby/object:Gem::Version
30
+ hash: 15
29
31
  segments:
30
32
  - 1
31
33
  - 0
@@ -40,6 +42,7 @@ dependencies:
40
42
  requirements:
41
43
  - - ~>
42
44
  - !ruby/object:Gem::Version
45
+ hash: 19
43
46
  segments:
44
47
  - 0
45
48
  - 1
@@ -55,6 +58,7 @@ dependencies:
55
58
  requirements:
56
59
  - - ~>
57
60
  - !ruby/object:Gem::Version
61
+ hash: 15
58
62
  segments:
59
63
  - 1
60
64
  - 0
@@ -69,6 +73,7 @@ dependencies:
69
73
  requirements:
70
74
  - - ">="
71
75
  - !ruby/object:Gem::Version
76
+ hash: 13
72
77
  segments:
73
78
  - 1
74
79
  - 2
@@ -90,7 +95,6 @@ files:
90
95
  - MIT-LICENSE
91
96
  - README.md
92
97
  - version.yml
93
- - examples/en.yml
94
98
  - examples/locale.rb
95
99
  - examples/translation.yml
96
100
  - lib/web_translate_it/auto_fetch.rb
@@ -134,6 +138,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
134
138
  requirements:
135
139
  - - ">="
136
140
  - !ruby/object:Gem::Version
141
+ hash: 3
137
142
  segments:
138
143
  - 0
139
144
  version: "0"
@@ -142,6 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
147
  requirements:
143
148
  - - ">="
144
149
  - !ruby/object:Gem::Version
150
+ hash: 3
145
151
  segments:
146
152
  - 0
147
153
  version: "0"
data/examples/en.yml DELETED
@@ -1,6 +0,0 @@
1
- fr:
2
- another_one: dskjdks
3
- another_string: "this is another string"
4
- hello: "Hello world!!"
5
- new_string: hehe
6
- test: " & & "