yaml-translator 0.9.2 → 0.10.0
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/yaml-translator/locale.rb +13 -7
- data/lib/yaml-translator/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d83ead6bbc4dd7809201407522741dd2fb85ce82
|
4
|
+
data.tar.gz: d8462fff5e332c68c41e73e72366ed7e2f43d380
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51c5f163f99d023570b1affa3030700aa0a0880a0006cd12b16a0c60f1a78cd800760182208a232ee04ece98eb82b2c4e5967a4999be262efdfb2c2cb5705355
|
7
|
+
data.tar.gz: 594b2ee9346e954f7d7d9fb9c254cb9439017ac0958d4036bf3704df4b6eedc2070335f01d5cc8b72f0d35c3304226eb369bc3e8dbf962e47c3b18d70937a1c1
|
data/Gemfile.lock
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'yaml'
|
2
|
+
require 'psych'
|
2
3
|
require 'ostruct'
|
3
4
|
require 'diff/lcs'
|
4
5
|
|
@@ -64,12 +65,12 @@ module YamlTranslator
|
|
64
65
|
target_locale.merge(self)
|
65
66
|
end
|
66
67
|
|
67
|
-
def save(dir=Dir.pwd)
|
68
|
-
write_file(File.join(dir, "#{lang}.yml"))
|
68
|
+
def save(dir=Dir.pwd, options={})
|
69
|
+
write_file(File.join(dir, "#{lang}.yml"), options)
|
69
70
|
end
|
70
71
|
|
71
|
-
def save_to(dir)
|
72
|
-
save(dir)
|
72
|
+
def save_to(dir, options={})
|
73
|
+
save(dir, options)
|
73
74
|
end
|
74
75
|
|
75
76
|
# Covert to a flatten hash
|
@@ -78,7 +79,12 @@ module YamlTranslator
|
|
78
79
|
end
|
79
80
|
|
80
81
|
def to_s
|
81
|
-
|
82
|
+
to_yaml
|
83
|
+
end
|
84
|
+
|
85
|
+
def to_yaml(options={})
|
86
|
+
p options
|
87
|
+
Hash[*[lang.to_s, locale_texts]].to_yaml(options)
|
82
88
|
end
|
83
89
|
|
84
90
|
private
|
@@ -122,8 +128,8 @@ module YamlTranslator
|
|
122
128
|
result
|
123
129
|
end
|
124
130
|
|
125
|
-
def write_file(file_path)
|
126
|
-
File.write(file_path,
|
131
|
+
def write_file(file_path, options={})
|
132
|
+
File.write(file_path, to_yaml(options))
|
127
133
|
end
|
128
134
|
end
|
129
135
|
end
|