web_translate_it 2.1.5 → 2.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/history.md +5 -0
- data/lib/web_translate_it.rb +2 -2
- data/lib/web_translate_it/auto_fetch.rb +5 -5
- data/lib/web_translate_it/command_line.rb +3 -2
- data/lib/web_translate_it/configuration.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8840c157cbda25ab687330a0a169e38305963efd
|
4
|
+
data.tar.gz: 7c525d74126a800ba7c39772dc81607f7012e938
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 384ebc9cc632375ec5fcec6922790e4dc7a72eef4ab03fa3fcf1385ab3365304a0c2cd2612770080c4a3cc70fdeaba01d1ae9887b02d88aa8437d6554f434b1a
|
7
|
+
data.tar.gz: 21b018dbc2ab1546bb9b432e904e3ef93cbdb9445f57eebccda07f4f55d739fcab5e842d02656954cf9fe5ff5da2a1f2a00ed365d59210c0b0755e5849a57372
|
data/history.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## Version 2.1.6 / 2013-08-02
|
2
|
+
|
3
|
+
* Commands now display more information, such as the current project’s name.
|
4
|
+
* Improvements to auto-fetch: reload I18n after fetch, and do not run auto-fetch for static requests.
|
5
|
+
|
1
6
|
## Version 2.1.5 / 2013-07-01
|
2
7
|
|
3
8
|
* Tweak `wti pull` to use up to 10 threads.
|
data/lib/web_translate_it.rb
CHANGED
@@ -16,14 +16,14 @@ require 'web_translate_it/command_line'
|
|
16
16
|
require 'web_translate_it/project'
|
17
17
|
|
18
18
|
module WebTranslateIt
|
19
|
-
|
19
|
+
|
20
20
|
def self.fetch_translations
|
21
21
|
config = Configuration.new
|
22
22
|
locale = I18n.locale.to_s
|
23
23
|
return if config.ignore_locales.include?(locale)
|
24
24
|
config.logger.debug { " Fetching #{locale} language file(s) from WebTranslateIt" } if config.logger
|
25
25
|
WebTranslateIt::Connection.new(config.api_key) do |http|
|
26
|
-
config.files.find_all{ |file| file.locale
|
26
|
+
config.files.find_all{ |file| file.locale.in?(locale, I18n.lang) }.each do |file|
|
27
27
|
response = file.fetch(http)
|
28
28
|
end
|
29
29
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module WebTranslateIt
|
3
|
-
|
3
|
+
|
4
4
|
# Class to automatically fetch the last translations from Web Translate It
|
5
5
|
# for every page requested.
|
6
6
|
# This can be used as a rack middleware.
|
@@ -13,11 +13,11 @@ module WebTranslateIt
|
|
13
13
|
def initialize(app)
|
14
14
|
@app = app
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def call(env)
|
18
|
-
WebTranslateIt::fetch_translations
|
19
|
-
|
20
|
-
|
18
|
+
WebTranslateIt::fetch_translations unless env['REQUEST_PATH'] =~ /\.(js|css|jpeg|jpg|gif|png|woff)$/
|
19
|
+
I18n.reload!
|
20
|
+
@app.call(env)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -25,7 +25,7 @@ module WebTranslateIt
|
|
25
25
|
else
|
26
26
|
message = "Gathering information"
|
27
27
|
end
|
28
|
-
throb { print " #{message}"; self.configuration = WebTranslateIt::Configuration.new(project_path, configuration_file_path) }
|
28
|
+
throb { print " #{message}"; self.configuration = WebTranslateIt::Configuration.new(project_path, configuration_file_path); print " #{message} on #{self.configuration.project_name}"; }
|
29
29
|
end
|
30
30
|
self.send(command)
|
31
31
|
end
|
@@ -182,7 +182,8 @@ module WebTranslateIt
|
|
182
182
|
end
|
183
183
|
File.open(path, 'w'){ |file| file << generate_configuration(api_key, project_info) }
|
184
184
|
puts ""
|
185
|
-
puts "
|
185
|
+
puts " The project #{project_info['name']} was successfully initialized."
|
186
|
+
puts ""
|
186
187
|
if project_info["source_locale"]["code"].nil? || project_info["target_locales"].size <= 1 || project_info["project_files"].none?
|
187
188
|
puts ""
|
188
189
|
puts " There are a few more things to set up:"
|
@@ -11,7 +11,7 @@ module WebTranslateIt
|
|
11
11
|
require 'yaml'
|
12
12
|
require 'fileutils'
|
13
13
|
attr_accessor :path, :api_key, :source_locale, :target_locales, :files, :ignore_locales
|
14
|
-
attr_accessor :logger, :before_pull, :after_pull, :before_push, :after_push
|
14
|
+
attr_accessor :logger, :before_pull, :after_pull, :before_push, :after_push, :project_name
|
15
15
|
|
16
16
|
# Load configuration file from the path.
|
17
17
|
def initialize(root_path = Rails.root, path_to_config_file = ".wti")
|
@@ -28,6 +28,7 @@ module WebTranslateIt
|
|
28
28
|
set_locales_to_ignore(configuration)
|
29
29
|
set_files(project_info['project'])
|
30
30
|
set_locales(project_info['project'])
|
31
|
+
self.project_name = project_info['project']['name']
|
31
32
|
else
|
32
33
|
puts StringUtil.failure("\nCan't find a configuration file in #{File.expand_path(path_to_config_file, self.path)}")
|
33
34
|
exit(1)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web_translate_it
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edouard Briere
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multipart-post
|