yaml-translator 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da4cda7e0c0b4e1d18d9263bc51e018e660b0902
4
- data.tar.gz: 66dbc7e06c1561486815e1e0c266cbaf54146057
3
+ metadata.gz: a4a2bedcfad980cb1ab2ad7d978ef33b70f374dc
4
+ data.tar.gz: eaab328e29e901828161d2c2795e2d012b71e307
5
5
  SHA512:
6
- metadata.gz: 92b3ccd4969f1df29d8a95b7110e2ecf24d04fb0066b5803e5ace67193a92ad3d6ba99c8992adb4b413c61bb317c6c543efe3016870a808df441de16ff9e2fe2
7
- data.tar.gz: ac073cf2fb71577ecc7376c5e1a4799c8de9ad37668220543e9f120f02284e01b62ff2bb58cf25daaa697c0cbbfa54cb081293772ed1e71fdf9bd55c13d92392
6
+ metadata.gz: 2dbcdfb27b69d1edc807d4fca2bf24cf0b472551a9db09900c7e4f7a3416ee66882ef8278b63ea7852529dd039b5b91f492d831df9ed113677ecf3fc53b4760d
7
+ data.tar.gz: 13035e4281a00fd05826585cee9780e753181cd140422fe4ff3aa0d796c1fc4feb8bdc250dd5a9ab9aa2bb4447290d3b90f72f0970cb41fb39ad3d5cc3f25d04
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yaml-translator (0.9.0)
4
+ yaml-translator (0.9.1)
5
5
  diff-lcs
6
6
  easy_translate
7
7
 
@@ -21,12 +21,13 @@ module YamlTranslator
21
21
  @lang = config.keys.first.to_sym # FIXME check support language
22
22
  end
23
23
 
24
+ def locale_texts
25
+ self[lang]
26
+ end
27
+
24
28
  def translate(translator, options={})
25
- result = {}
26
- values = to_h
27
- translated_values = translator.translate(compact_of(values[@lang]), options)
28
- result[options[:to]] = tree_of(translated_values)
29
- Locale.new(result)
29
+ translated_values = translator.translate(compact_of(locale_texts), options)
30
+ Locale.new(Hash[*[options[:to], tree_of(translated_values)]])
30
31
  end
31
32
 
32
33
  def diff(other_locale)
@@ -75,7 +76,7 @@ module YamlTranslator
75
76
  end
76
77
 
77
78
  def to_s
78
- YAML.dump(tree_of(compact_of(to_h)))
79
+ YAML.dump(Hash[*[lang.to_s, locale_texts]])
79
80
  end
80
81
 
81
82
  private
@@ -1,3 +1,3 @@
1
1
  module YamlTranslator
2
- VERSION = '0.9.0'
2
+ VERSION = '0.9.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaml-translator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noritaka Horio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-11 00:00:00.000000000 Z
11
+ date: 2017-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: easy_translate