i18n_generators 1.0.0 → 1.0.1
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.
- data/History.txt +5 -0
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/i18n_generators.gemspec +3 -5
- data/lib/generators/i18n_translation/i18n_translation_generator.rb +3 -1
- data/lib/generators/i18n_translation/lib/yaml.rb +1 -1
- data/lib/generators/i18n_translation/lib/yaml_waml.rb +35 -0
- metadata +7 -19
data/History.txt
CHANGED
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/i18n_generators.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{i18n_generators}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Akira Matsuda"]
|
12
|
-
s.date = %q{2010-10-
|
12
|
+
s.date = %q{2010-10-31}
|
13
13
|
s.description = %q{A Rails generator plugin & gem that generates Rails I18n locale files for almost every known locale.}
|
14
14
|
s.email = %q{ronnie@dio.jp}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -59,6 +59,7 @@ Gem::Specification.new do |s|
|
|
59
59
|
"lib/generators/i18n_translation/i18n_translation_generator.rb",
|
60
60
|
"lib/generators/i18n_translation/lib/translator.rb",
|
61
61
|
"lib/generators/i18n_translation/lib/yaml.rb",
|
62
|
+
"lib/generators/i18n_translation/lib/yaml_waml.rb",
|
62
63
|
"spec/cldr_spec.rb",
|
63
64
|
"spec/data/cldr/ja.html",
|
64
65
|
"spec/data/yml/active_record/en-US.yml",
|
@@ -87,12 +88,9 @@ Gem::Specification.new do |s|
|
|
87
88
|
s.specification_version = 3
|
88
89
|
|
89
90
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
90
|
-
s.add_runtime_dependency(%q<yaml_waml>, [">= 0"])
|
91
91
|
else
|
92
|
-
s.add_dependency(%q<yaml_waml>, [">= 0"])
|
93
92
|
end
|
94
93
|
else
|
95
|
-
s.add_dependency(%q<yaml_waml>, [">= 0"])
|
96
94
|
end
|
97
95
|
end
|
98
96
|
|
@@ -25,7 +25,9 @@ class I18nTranslationGenerator < Rails::Generators::NamedBase
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
unless (yaml_string = yaml.to_s(true)).blank?
|
29
|
+
create_file "config/locales/translation_#{locale_name}.yml", yaml_string
|
30
|
+
end
|
29
31
|
end
|
30
32
|
|
31
33
|
private
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "yaml"
|
2
|
+
|
3
|
+
class String
|
4
|
+
def is_binary_data?
|
5
|
+
false
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
module YamlWaml
|
10
|
+
def decode(orig_yamled)
|
11
|
+
yamled_str = case orig_yamled
|
12
|
+
when String then orig_yamled
|
13
|
+
when StringIO then orig_yamled.string
|
14
|
+
else return orig_yamled
|
15
|
+
end
|
16
|
+
yamled_str.gsub!(/\\x(\w{2})/){[$1].pack("H2")}
|
17
|
+
return yamled_str
|
18
|
+
end
|
19
|
+
module_function :decode
|
20
|
+
end
|
21
|
+
|
22
|
+
ObjectSpace.each_object(Class) do |klass|
|
23
|
+
klass.class_eval do
|
24
|
+
if method_defined?(:to_yaml) && !method_defined?(:to_yaml_with_decode)
|
25
|
+
def to_yaml_with_decode(*args)
|
26
|
+
io = args.shift if IO === args.first
|
27
|
+
yamled_str = YamlWaml.decode(to_yaml_without_decode(*args))
|
28
|
+
io.write(yamled_str) if io
|
29
|
+
return yamled_str
|
30
|
+
end
|
31
|
+
alias_method :to_yaml_without_decode, :to_yaml
|
32
|
+
alias_method :to_yaml, :to_yaml_with_decode
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n_generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Akira Matsuda
|
@@ -15,23 +15,10 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-31 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
|
22
|
-
name: yaml_waml
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
33
|
-
type: :runtime
|
34
|
-
version_requirements: *id001
|
20
|
+
dependencies: []
|
21
|
+
|
35
22
|
description: A Rails generator plugin & gem that generates Rails I18n locale files for almost every known locale.
|
36
23
|
email: ronnie@dio.jp
|
37
24
|
executables: []
|
@@ -84,6 +71,7 @@ files:
|
|
84
71
|
- lib/generators/i18n_translation/i18n_translation_generator.rb
|
85
72
|
- lib/generators/i18n_translation/lib/translator.rb
|
86
73
|
- lib/generators/i18n_translation/lib/yaml.rb
|
74
|
+
- lib/generators/i18n_translation/lib/yaml_waml.rb
|
87
75
|
- spec/cldr_spec.rb
|
88
76
|
- spec/data/cldr/ja.html
|
89
77
|
- spec/data/yml/active_record/en-US.yml
|