i18n-translators-tools 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/i18n-translate +8 -3
- data/i18n-translators-tools.gemspec +17 -11
- data/lib/i18n/translate.rb +9 -0
- metadata +19 -13
data/bin/i18n-translate
CHANGED
@@ -115,9 +115,14 @@ def process_locale(tr, command, opts)
|
|
115
115
|
msg="striped"
|
116
116
|
save_locale = true
|
117
117
|
when 'merge'
|
118
|
-
|
119
|
-
|
120
|
-
|
118
|
+
if File.exists?(tr.default_file)
|
119
|
+
tr.assign(tr.merge)
|
120
|
+
msg="merged"
|
121
|
+
msg << " with #{tr.default_file}" if options[:verbose]
|
122
|
+
save_locale = true
|
123
|
+
else
|
124
|
+
msg="no default file (expected: #{tr.default_file})"
|
125
|
+
end
|
121
126
|
when 'convert'
|
122
127
|
tr.options[:format] = options[:target]
|
123
128
|
msg="converted"
|
@@ -8,13 +8,13 @@ require 'find'
|
|
8
8
|
|
9
9
|
spec = Gem::Specification.new do |s|
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
|
-
s.summary = "I18n
|
11
|
+
s.summary = "I18n translation utility which helps to manage files with locales."
|
12
12
|
s.homepage = "http://github.com/pejuko/i18n-translators-tools"
|
13
13
|
s.email = "pejuko@gmail.com"
|
14
14
|
s.authors = ["Petr Kovar"]
|
15
15
|
s.name = 'i18n-translators-tools'
|
16
|
-
s.version = '0.2.
|
17
|
-
s.date =
|
16
|
+
s.version = '0.2.2'
|
17
|
+
s.date = Time.now.strftime("%Y-%m-%d")
|
18
18
|
s.add_dependency('i18n', '>= 0.4.1')
|
19
19
|
s.add_dependency('ya2yaml')
|
20
20
|
s.require_path = 'lib'
|
@@ -22,11 +22,11 @@ spec = Gem::Specification.new do |s|
|
|
22
22
|
s.files += Dir["lib/**/*.rb", "test/**/*.{rb,yml,po}"]
|
23
23
|
s.executables = ["i18n-translate"]
|
24
24
|
s.post_install_message = <<EOF
|
25
|
-
|
25
|
+
=============================================================================
|
26
26
|
|
27
27
|
I18N TRANSLATORS TOOLS
|
28
28
|
|
29
|
-
|
29
|
+
-----------------------------------------------------------------------------
|
30
30
|
|
31
31
|
Supported formats:
|
32
32
|
* yml
|
@@ -36,7 +36,7 @@ Supported formats:
|
|
36
36
|
* properties
|
37
37
|
|
38
38
|
Backends:
|
39
|
-
* Extended format. i18n-translators-tools
|
39
|
+
* Extended format. i18n-translators-tools brings extended format
|
40
40
|
I18n::Backend::Simple.send(:include, I18n::Backend::Translator)
|
41
41
|
* Gettext po
|
42
42
|
I18n::Backend::Simple.send(:include, I18n::Backend::PO)
|
@@ -51,17 +51,23 @@ Functions:
|
|
51
51
|
* translate (built-in simple console translator)
|
52
52
|
* statistics
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
Changelog:
|
55
|
+
v0.2.1
|
56
|
+
* fix: I18n::Backend::Translate now returns nil if translation is empty
|
57
|
+
string (this allows fallbacks)
|
58
|
+
|
59
|
+
v0.2.2
|
60
|
+
* fix: don't merge if default file doesn't exist (locale stays untouched)
|
61
|
+
* fix: for default format autodetection works again
|
62
|
+
* merge can be more verbose
|
57
63
|
|
58
64
|
For more information read README.md and CHANGELOG.md
|
59
65
|
|
60
|
-
|
66
|
+
-----------------------------------------------------------------------------
|
61
67
|
|
62
68
|
http://github.com/pejuko/i18n-translators-tools
|
63
69
|
|
64
|
-
|
70
|
+
=============================================================================
|
65
71
|
EOF
|
66
72
|
s.description = <<EOF
|
67
73
|
This package brings you useful utility which can help you to handle locale files
|
data/lib/i18n/translate.rb
CHANGED
@@ -173,9 +173,18 @@ module I18n::Translate
|
|
173
173
|
def initialize(lang, opts={})
|
174
174
|
@lang = lang.to_s
|
175
175
|
raise "Empty locale" if @lang.empty? and not opts[:empty]
|
176
|
+
|
177
|
+
# merge options
|
176
178
|
@options = DEFAULT_OPTIONS.merge(opts)
|
179
|
+
|
180
|
+
# select default format
|
177
181
|
@options[:default_format] ||= @options[:format]
|
182
|
+
if (@options[:default_format] == @options[:format]) and not opts[:default_format]
|
183
|
+
dfname = file_name(@options[:default], @options[:default_format])
|
184
|
+
@options[:default_format] = "auto" unless File.exists?(dfname)
|
185
|
+
end
|
178
186
|
|
187
|
+
# load default data and translation
|
179
188
|
if @lang and not opts[:empty]
|
180
189
|
@default, @default_file = load_locale( @options[:default], @options[:default_format] )
|
181
190
|
@target, @lang_file = load_locale( @lang )
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n-translators-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Petr Kovar
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-28 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -108,11 +108,11 @@ homepage: http://github.com/pejuko/i18n-translators-tools
|
|
108
108
|
licenses: []
|
109
109
|
|
110
110
|
post_install_message: |
|
111
|
-
|
111
|
+
=============================================================================
|
112
112
|
|
113
113
|
I18N TRANSLATORS TOOLS
|
114
114
|
|
115
|
-
|
115
|
+
-----------------------------------------------------------------------------
|
116
116
|
|
117
117
|
Supported formats:
|
118
118
|
* yml
|
@@ -122,7 +122,7 @@ post_install_message: |
|
|
122
122
|
* properties
|
123
123
|
|
124
124
|
Backends:
|
125
|
-
* Extended format. i18n-translators-tools
|
125
|
+
* Extended format. i18n-translators-tools brings extended format
|
126
126
|
I18n::Backend::Simple.send(:include, I18n::Backend::Translator)
|
127
127
|
* Gettext po
|
128
128
|
I18n::Backend::Simple.send(:include, I18n::Backend::PO)
|
@@ -137,17 +137,23 @@ post_install_message: |
|
|
137
137
|
* translate (built-in simple console translator)
|
138
138
|
* statistics
|
139
139
|
|
140
|
-
|
141
|
-
|
142
|
-
|
140
|
+
Changelog:
|
141
|
+
v0.2.1
|
142
|
+
* fix: I18n::Backend::Translate now returns nil if translation is empty
|
143
|
+
string (this allows fallbacks)
|
144
|
+
|
145
|
+
v0.2.2
|
146
|
+
* fix: don't merge if default file doesn't exist (locale stays untouched)
|
147
|
+
* fix: for default format autodetection works again
|
148
|
+
* merge can be more verbose
|
143
149
|
|
144
150
|
For more information read README.md and CHANGELOG.md
|
145
151
|
|
146
|
-
|
152
|
+
-----------------------------------------------------------------------------
|
147
153
|
|
148
154
|
http://github.com/pejuko/i18n-translators-tools
|
149
155
|
|
150
|
-
|
156
|
+
=============================================================================
|
151
157
|
|
152
158
|
rdoc_options: []
|
153
159
|
|
@@ -177,6 +183,6 @@ rubyforge_project:
|
|
177
183
|
rubygems_version: 1.3.7
|
178
184
|
signing_key:
|
179
185
|
specification_version: 3
|
180
|
-
summary: I18n
|
186
|
+
summary: I18n translation utility which helps to manage files with locales.
|
181
187
|
test_files: []
|
182
188
|
|