idiom 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/idiom.gemspec +1 -1
- data/lib/idiom/base.rb +9 -1
- data/lib/idiom/yaml.rb +7 -3
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.3
|
data/idiom.gemspec
CHANGED
data/lib/idiom/base.rb
CHANGED
@@ -193,6 +193,7 @@ module Idiom #:nodoc:
|
|
193
193
|
end
|
194
194
|
|
195
195
|
def generate
|
196
|
+
before_translation
|
196
197
|
non_us_locales.each do |lang|
|
197
198
|
code = LOCALES[lang]
|
198
199
|
destination = ensure_destination_path_exists(lang)
|
@@ -202,6 +203,13 @@ module Idiom #:nodoc:
|
|
202
203
|
write_content(destination, new_content)
|
203
204
|
clear_all_keys
|
204
205
|
end
|
206
|
+
after_translation
|
207
|
+
end
|
208
|
+
|
209
|
+
def before_translation
|
210
|
+
end
|
211
|
+
|
212
|
+
def after_translation
|
205
213
|
end
|
206
214
|
|
207
215
|
def new_translation_message
|
@@ -269,7 +277,7 @@ module Idiom #:nodoc:
|
|
269
277
|
line = line.split("\n").first
|
270
278
|
if comment?(line) || line.blank?
|
271
279
|
nil
|
272
|
-
elsif line == "en:"
|
280
|
+
elsif line.strip == "en:"
|
273
281
|
"#{lang}:"
|
274
282
|
else
|
275
283
|
translate_new_key(line, lang)
|
data/lib/idiom/yaml.rb
CHANGED
@@ -5,8 +5,12 @@ module Idiom #:nodoc:
|
|
5
5
|
# Translator::Yaml.new().copy
|
6
6
|
#
|
7
7
|
class Yaml < Base
|
8
|
-
def destination_path(lang)
|
9
|
-
source
|
8
|
+
def destination_path(lang=nil)
|
9
|
+
"#{source}.tmp"
|
10
|
+
end
|
11
|
+
|
12
|
+
def after_translation
|
13
|
+
system "cat #{destination_path} >> #{source} && rm #{destination_path}"
|
10
14
|
end
|
11
15
|
|
12
16
|
def extension
|
@@ -14,7 +18,7 @@ module Idiom #:nodoc:
|
|
14
18
|
end
|
15
19
|
|
16
20
|
def parse(path)
|
17
|
-
YAML.load_file(path)
|
21
|
+
YAML.load_file(path) || {}
|
18
22
|
end
|
19
23
|
|
20
24
|
def format(key, value)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: idiom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 3
|
10
|
+
version: 0.4.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jeff Coleman
|