i18n_generators 0.8.0 → 0.8.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/README.rdoc +2 -5
- data/VERSION +1 -1
- data/generators/i18n_translation/i18n_translation_command.rb +9 -5
- data/i18n_generators.gemspec +2 -2
- metadata +4 -4
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= I18n generators
|
2
2
|
|
3
|
-
This gem plugin generates a set of locale files for Rails 2.2 i18n feature.
|
3
|
+
This gem plugin generates a set of locale files for Rails 2.2 and 2.3 i18n feature.
|
4
4
|
|
5
5
|
* http://github.com/amatsuda/i18n_generators/tree/master
|
6
6
|
|
@@ -84,9 +84,7 @@ Executes 2 and 3 at once.
|
|
84
84
|
|
85
85
|
* As a gem
|
86
86
|
|
87
|
-
%
|
88
|
-
|
89
|
-
% sudo gem install amatsuda-i18n_generators
|
87
|
+
% gem install i18n_generators
|
90
88
|
|
91
89
|
* As a Rails plugin
|
92
90
|
|
@@ -101,4 +99,3 @@ Please be careful not to harm your network environment and CLDR website by runni
|
|
101
99
|
|
102
100
|
|
103
101
|
Copyright (c) 2008 Akira Matsuda, released under the MIT license
|
104
|
-
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.1
|
@@ -69,7 +69,11 @@ module I18nGenerator::Generator
|
|
69
69
|
yaml = YamlDocument.new("config/locales/translation_#{locale_name}.yml", locale_name)
|
70
70
|
each_value [], translations do |parents, value|
|
71
71
|
node = parents.inject(yaml[locale_name]) {|node, parent| node[parent]}
|
72
|
-
|
72
|
+
if value.is_a? String
|
73
|
+
node.value = value
|
74
|
+
else
|
75
|
+
value.each {|key, val| node[key].value = val}
|
76
|
+
end
|
73
77
|
end
|
74
78
|
yaml
|
75
79
|
end
|
@@ -93,11 +97,11 @@ module I18nGenerator::Generator
|
|
93
97
|
Thread.pass
|
94
98
|
if key.to_s.include? '.'
|
95
99
|
key_prefix, key_suffix = key.to_s.split('.')[0...-1], key.to_s.split('.')[-1]
|
96
|
-
existing_translation = I18n.
|
97
|
-
key_prefix.inject(oh) {|h, k| h[k]}[key_suffix] = existing_translation
|
100
|
+
existing_translation = I18n.backend.send(:lookup, locale_name, key_suffix, key_prefix)
|
101
|
+
key_prefix.inject(oh) {|h, k| h[k]}[key_suffix] = existing_translation ? existing_translation : translator.translate(key_suffix)
|
98
102
|
else
|
99
|
-
existing_translation = I18n.
|
100
|
-
oh[key] = existing_translation
|
103
|
+
existing_translation = I18n.backend.send(:lookup, locale_name, key)
|
104
|
+
oh[key] = existing_translation ? existing_translation : translator.translate(key)
|
101
105
|
end
|
102
106
|
end
|
103
107
|
end
|
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 = "0.8.
|
8
|
+
s.version = "0.8.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-
|
12
|
+
s.date = %q{2010-10-23}
|
13
13
|
s.description = %q{A Rails generator plugin & gem that generates Rails 2.2 and 2.3 I18n locale files for almost every known locale.}
|
14
14
|
s.email = %q{ronnie@dio.jp}
|
15
15
|
s.extra_rdoc_files = [
|
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: 61
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 1
|
10
|
+
version: 0.8.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Akira Matsuda
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-10-23 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|