r18n-core 2.2.0 → 3.0.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 +5 -5
- data/.rspec +1 -1
- data/ChangeLog.md +6 -1
- data/README.md +1 -20
- data/Rakefile +5 -3
- data/lib/r18n-core.rb +55 -55
- data/lib/r18n-core/filter_list.rb +34 -36
- data/lib/r18n-core/filters.rb +68 -51
- data/lib/r18n-core/helpers.rb +17 -17
- data/lib/r18n-core/i18n.rb +46 -39
- data/lib/r18n-core/locale.rb +79 -70
- data/lib/r18n-core/translated.rb +65 -66
- data/lib/r18n-core/translated_string.rb +24 -24
- data/lib/r18n-core/translation.rb +31 -30
- data/lib/r18n-core/unsupported_locale.rb +22 -24
- data/lib/r18n-core/untranslated.rb +35 -33
- data/lib/r18n-core/utils.rb +26 -25
- data/lib/r18n-core/version.rb +4 -1
- data/lib/r18n-core/yaml_loader.rb +26 -25
- data/lib/r18n-core/yaml_methods.rb +25 -28
- data/locales/af.rb +15 -8
- data/locales/az.rb +19 -12
- data/locales/bg.rb +16 -9
- data/locales/ca.rb +16 -9
- data/locales/cs.rb +27 -20
- data/locales/da.rb +15 -8
- data/locales/de.rb +16 -9
- data/locales/en-au.rb +10 -5
- data/locales/en-gb.rb +12 -5
- data/locales/en-us.rb +12 -5
- data/locales/en.rb +29 -22
- data/locales/eo.rb +14 -7
- data/locales/es-us.rb +12 -5
- data/locales/es.rb +14 -7
- data/locales/fa.rb +48 -32
- data/locales/fi.rb +19 -12
- data/locales/fr.rb +22 -15
- data/locales/gl.rb +15 -8
- data/locales/hr.rb +24 -17
- data/locales/hu.rb +28 -21
- data/locales/id.rb +14 -7
- data/locales/it.rb +21 -14
- data/locales/ja.rb +15 -8
- data/locales/kk.rb +17 -10
- data/locales/ko.rb +15 -9
- data/locales/lv.rb +24 -17
- data/locales/mn.rb +10 -3
- data/locales/nb.rb +15 -8
- data/locales/nl.rb +15 -8
- data/locales/no.rb +11 -16
- data/locales/pl.rb +26 -19
- data/locales/pt-br.rb +12 -5
- data/locales/pt.rb +17 -10
- data/locales/ru.rb +26 -19
- data/locales/sk.rb +27 -20
- data/locales/sr-latn.rb +27 -22
- data/locales/sv-se.rb +15 -8
- data/locales/th.rb +27 -20
- data/locales/tr.rb +16 -9
- data/locales/uk.rb +19 -12
- data/locales/vi.rb +14 -7
- data/locales/zh-cn.rb +12 -5
- data/locales/zh-tw.rb +15 -8
- data/locales/zh.rb +14 -7
- data/r18n-core.gemspec +5 -3
- data/spec/filters_spec.rb +71 -67
- data/spec/i18n_spec.rb +73 -51
- data/spec/locale_spec.rb +73 -68
- data/spec/locales/cs_spec.rb +2 -2
- data/spec/locales/en-us_spec.rb +9 -9
- data/spec/locales/en_spec.rb +2 -2
- data/spec/locales/fa_spec.rb +3 -3
- data/spec/locales/fr_spec.rb +2 -2
- data/spec/locales/hu_spec.rb +7 -7
- data/spec/locales/it_spec.rb +3 -3
- data/spec/locales/no_spec.rb +9 -0
- data/spec/locales/pl_spec.rb +2 -2
- data/spec/locales/ru_spec.rb +2 -2
- data/spec/locales/sk_spec.rb +2 -2
- data/spec/locales/th_spec.rb +2 -2
- data/spec/locales/vi_spec.rb +2 -2
- data/spec/r18n_spec.rb +44 -38
- data/spec/spec_helper.rb +13 -9
- data/spec/translated_spec.rb +48 -31
- data/spec/translation_spec.rb +29 -27
- data/spec/translations/general/en.yml +0 -2
- data/spec/yaml_loader_spec.rb +22 -18
- metadata +5 -3
data/lib/r18n-core/translated.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
the
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Add i18n support to any class.
|
4
|
+
#
|
5
|
+
# Copyright (C) 2008 Andrey “A.I.” Sitnik <andrey@sitnik.ru>
|
6
|
+
#
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Lesser General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Lesser General Public License
|
18
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
19
|
|
20
20
|
module R18n
|
21
21
|
# Module to add i18n support to any class. It will be useful for ORM or
|
@@ -112,64 +112,63 @@ module R18n
|
|
112
112
|
# translation :desciption, type: 'markdown'
|
113
113
|
def translation(name, options = {})
|
114
114
|
if options[:methods]
|
115
|
-
@unlocalized_getters[name] = R18n::Utils
|
116
|
-
hash_map(options[:methods]) { |l, i| [
|
115
|
+
@unlocalized_getters[name] = R18n::Utils
|
116
|
+
.hash_map(options[:methods]) { |l, i| [l.to_s, i.to_s] }
|
117
117
|
unless options[:no_write]
|
118
|
-
@unlocalized_setters[name] = R18n::Utils
|
119
|
-
hash_map(options[:methods]) { |l, i| [
|
118
|
+
@unlocalized_setters[name] = R18n::Utils
|
119
|
+
.hash_map(options[:methods]) { |l, i| [l.to_s, i.to_s + '='] }
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
123
|
@translation_types[name] = options[:type]
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
124
|
+
|
125
|
+
define_method name do |*params|
|
126
|
+
unlocalized = self.class.unlocalized_getters(name)
|
127
|
+
result = nil
|
128
|
+
|
129
|
+
r18n.locales.each do |locale|
|
130
|
+
code = locale.code
|
131
|
+
next unless unlocalized.key? code
|
132
|
+
result = send(
|
133
|
+
unlocalized[code], *(params unless options[:no_params])
|
134
|
+
)
|
135
|
+
next unless result
|
136
|
+
|
137
|
+
path = "#{self.class.name}##{name}"
|
138
|
+
type = self.class.translation_types[name]
|
139
|
+
if type
|
140
|
+
return r18n.filter_list.process(
|
141
|
+
:all, type, result, locale, path, params
|
142
|
+
)
|
143
|
+
elsif result.is_a? String
|
144
|
+
result = TranslatedString.new(result, locale, path)
|
145
|
+
return r18n.filter_list.process_string(
|
146
|
+
:all, result, path, params
|
147
|
+
)
|
148
|
+
else
|
149
|
+
return result
|
149
150
|
end
|
151
|
+
end
|
152
|
+
|
153
|
+
result
|
154
|
+
end
|
150
155
|
|
151
|
-
|
156
|
+
return if options[:no_write]
|
157
|
+
|
158
|
+
define_method "#{name}=" do |*params|
|
159
|
+
unlocalized = self.class.unlocalized_setters(name)
|
160
|
+
r18n.locales.each do |locale|
|
161
|
+
code = locale.code
|
162
|
+
next unless unlocalized.key? code
|
163
|
+
return send unlocalized[code], *params
|
152
164
|
end
|
153
|
-
EOS
|
154
|
-
|
155
|
-
unless options[:no_write]
|
156
|
-
class_eval <<-EOS, __FILE__, __LINE__
|
157
|
-
def #{name}=(*params)
|
158
|
-
unlocalized = self.class.unlocalized_setters(#{name.inspect})
|
159
|
-
r18n.locales.each do |locale|
|
160
|
-
code = locale.code
|
161
|
-
next unless unlocalized.has_key? code
|
162
|
-
return send unlocalized[code], *params
|
163
|
-
end
|
164
|
-
end
|
165
|
-
EOS
|
166
165
|
end
|
167
166
|
end
|
168
167
|
|
169
168
|
# Return array of methods to find +unlocalized_getters+ or
|
170
169
|
# +unlocalized_setters+.
|
171
170
|
def unlocalized_methods
|
172
|
-
|
171
|
+
instance_methods
|
173
172
|
end
|
174
173
|
|
175
174
|
# Return Hash of locale code to getter method for proxy +method+. If you
|
@@ -177,9 +176,9 @@ module R18n
|
|
177
176
|
# automatically.
|
178
177
|
def unlocalized_getters(method)
|
179
178
|
matcher = Regexp.new('^' + Regexp.escape(method.to_s) + '_(\w+)$')
|
180
|
-
unless @unlocalized_getters.
|
179
|
+
unless @unlocalized_getters.key? method
|
181
180
|
@unlocalized_getters[method] = {}
|
182
|
-
|
181
|
+
unlocalized_methods.select { |i| i =~ matcher }.each do |i|
|
183
182
|
@unlocalized_getters[method][i.to_s.match(matcher)[1]] = i.to_s
|
184
183
|
end
|
185
184
|
end
|
@@ -191,9 +190,9 @@ module R18n
|
|
191
190
|
# automatically.
|
192
191
|
def unlocalized_setters(method)
|
193
192
|
matcher = Regexp.new('^' + Regexp.escape(method.to_s) + '_(\w+)=$')
|
194
|
-
unless @unlocalized_setters.
|
193
|
+
unless @unlocalized_setters.key? method
|
195
194
|
@unlocalized_setters[method] = {}
|
196
|
-
|
195
|
+
unlocalized_methods.select { |i| i =~ matcher }.each do |i|
|
197
196
|
@unlocalized_setters[method][i.to_s.match(matcher)[1]] = i.to_s
|
198
197
|
end
|
199
198
|
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
the
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Translation string for i18n support.
|
4
|
+
#
|
5
|
+
# Copyright (C) 2008 Andrey “A.I.” Sitnik <andrey@sitnik.ru>
|
6
|
+
#
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Lesser General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Lesser General Public License
|
18
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
19
|
|
20
20
|
module R18n
|
21
21
|
# String, which is translated to some locale and loading from Translation.
|
@@ -36,7 +36,7 @@ module R18n
|
|
36
36
|
end
|
37
37
|
|
38
38
|
# Return self for translated string.
|
39
|
-
def |(
|
39
|
+
def |(_other)
|
40
40
|
self
|
41
41
|
end
|
42
42
|
|
@@ -60,18 +60,18 @@ module R18n
|
|
60
60
|
end
|
61
61
|
|
62
62
|
# Define `as_json` for ActiveSupport compatibility.
|
63
|
-
def as_json(
|
63
|
+
def as_json(_options = nil)
|
64
64
|
to_str
|
65
65
|
end
|
66
66
|
|
67
67
|
# Override marshal_dump to avoid Marshalizing filter procs
|
68
|
-
def _dump(
|
69
|
-
[@locale.code, @path, to_str].join(
|
68
|
+
def _dump(_limit)
|
69
|
+
[@locale.code, @path, to_str].join(':')
|
70
70
|
end
|
71
71
|
|
72
72
|
# Load object from Marshalizing.
|
73
73
|
def self._load(str)
|
74
|
-
arr = str.split(
|
74
|
+
arr = str.split(':', 3)
|
75
75
|
new arr[2], R18n.locale(arr[0]), arr[1]
|
76
76
|
end
|
77
77
|
|
@@ -83,7 +83,7 @@ module R18n
|
|
83
83
|
end
|
84
84
|
|
85
85
|
# Return untranslated, when user try to go deeper in translation.
|
86
|
-
def method_missing(name, *
|
86
|
+
def method_missing(name, *_params)
|
87
87
|
get_untranslated(name.to_s)
|
88
88
|
end
|
89
89
|
end
|
@@ -1,23 +1,21 @@
|
|
1
|
-
|
2
|
-
Translation to i18n support.
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
require 'pathname'
|
3
|
+
# Translation to i18n support.
|
4
|
+
#
|
5
|
+
# Copyright (C) 2008 Andrey “A.I.” Sitnik <andrey@sitnik.ru>
|
6
|
+
#
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Lesser General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Lesser General Public License
|
18
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
21
19
|
|
22
20
|
module R18n
|
23
21
|
# Struct to containt translation with some type for filter.
|
@@ -83,13 +81,15 @@ module R18n
|
|
83
81
|
# Add another hash with +translations+ for some +locale+. Current data is
|
84
82
|
# more priority, that new one in +translations+.
|
85
83
|
def merge!(translations, locale)
|
86
|
-
(translations || {
|
87
|
-
if
|
84
|
+
(translations || {}).each_pair do |name, value|
|
85
|
+
if !@data.key?(name)
|
88
86
|
path = @path.empty? ? name : "#{@path}.#{name}"
|
89
87
|
case value
|
90
88
|
when Hash
|
91
|
-
value = Translation.new(
|
92
|
-
locale
|
89
|
+
value = Translation.new(
|
90
|
+
@locale, path,
|
91
|
+
locale: locale, translations: value, filters: @filters
|
92
|
+
)
|
93
93
|
when String
|
94
94
|
c = { locale: locale, path: path }
|
95
95
|
v = @filters.process_string(:passive, value, c, [])
|
@@ -98,11 +98,11 @@ module R18n
|
|
98
98
|
value.locale = locale
|
99
99
|
value.path = path
|
100
100
|
unless @filters.passive(value.type).empty?
|
101
|
-
value = @filters.process_typed(:passive, value, {
|
101
|
+
value = @filters.process_typed(:passive, value, {})
|
102
102
|
end
|
103
103
|
end
|
104
104
|
@data[name] = value
|
105
|
-
elsif @data[name].is_a?
|
105
|
+
elsif @data[name].is_a?(Translation) && value.is_a?(Hash)
|
106
106
|
@data[name].merge! value, locale
|
107
107
|
end
|
108
108
|
end
|
@@ -110,8 +110,9 @@ module R18n
|
|
110
110
|
|
111
111
|
# Use untranslated filter to print path.
|
112
112
|
def to_s
|
113
|
-
@filters.process(
|
114
|
-
|
113
|
+
@filters.process(
|
114
|
+
:all, Untranslated, @path, @locale, @path, [@path, '', @path]
|
115
|
+
)
|
115
116
|
end
|
116
117
|
|
117
118
|
# Override inspect to easy debug.
|
@@ -136,8 +137,8 @@ module R18n
|
|
136
137
|
end
|
137
138
|
|
138
139
|
# Return +default+.
|
139
|
-
def |(
|
140
|
-
|
140
|
+
def |(other)
|
141
|
+
other
|
141
142
|
end
|
142
143
|
|
143
144
|
# Return translation with special +name+.
|
@@ -146,7 +147,7 @@ module R18n
|
|
146
147
|
# <tt>%2</tt>, etc in translations file and set values in next +params+.
|
147
148
|
def [](name, *params)
|
148
149
|
unless [String, Integer, TrueClass, FalseClass]
|
149
|
-
|
150
|
+
.any? { |klass| name.is_a?(klass) }
|
150
151
|
name = name.to_s
|
151
152
|
end
|
152
153
|
value = @data[name]
|
@@ -1,21 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
the
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Locale withou information file to i18n support.
|
4
|
+
#
|
5
|
+
# Copyright (C) 2008 Andrey “A.I.” Sitnik <andrey@sitnik.ru>
|
6
|
+
#
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Lesser General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Lesser General Public License
|
18
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
19
|
|
20
20
|
module R18n
|
21
21
|
# Locale without information file. Contain only it code, empty title and data
|
@@ -26,7 +26,7 @@ module R18n
|
|
26
26
|
|
27
27
|
# Create object for unsupported locale with +code+ and load other locale
|
28
28
|
# data from +base+ locale.
|
29
|
-
def initialize(code,
|
29
|
+
def initialize(code, _base = nil)
|
30
30
|
@code = code
|
31
31
|
@base = Locale.load(I18n.default) if @code != I18n.default
|
32
32
|
end
|
@@ -42,9 +42,7 @@ module R18n
|
|
42
42
|
end
|
43
43
|
|
44
44
|
# Locale RFC 3066 code.
|
45
|
-
|
46
|
-
@code
|
47
|
-
end
|
45
|
+
attr_reader :code
|
48
46
|
|
49
47
|
# Locale code as title.
|
50
48
|
def title
|
@@ -52,8 +50,8 @@ module R18n
|
|
52
50
|
end
|
53
51
|
|
54
52
|
# Is another locale has same code.
|
55
|
-
def ==(
|
56
|
-
@code.
|
53
|
+
def ==(other)
|
54
|
+
@code.casecmp(other.code).zero?
|
57
55
|
end
|
58
56
|
|
59
57
|
# Proxy to default locale object.
|
@@ -1,21 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
the
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Untranslation string for i18n support.
|
4
|
+
#
|
5
|
+
# Copyright (C) 2008 Andrey “A.I.” Sitnik <andrey@sitnik.ru>
|
6
|
+
#
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Lesser General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Lesser General Public License
|
18
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
19
|
|
20
20
|
module R18n
|
21
21
|
# Return if translation isn’t exists. Unlike nil, it didn’t raise error when
|
@@ -63,20 +63,20 @@ module R18n
|
|
63
63
|
end
|
64
64
|
|
65
65
|
# Override marshal_dump to avoid Marshalizing filter procs
|
66
|
-
def _dump(
|
67
|
-
[@locale.code, @translated_path, @untranslated_path].join(
|
66
|
+
def _dump(_limit)
|
67
|
+
[@locale.code, @translated_path, @untranslated_path].join(':')
|
68
68
|
end
|
69
69
|
|
70
70
|
# Load object from Marshalizing.
|
71
71
|
def self._load(str)
|
72
|
-
arr = str.split(
|
72
|
+
arr = str.split(':', 3)
|
73
73
|
new arr[1], arr[2], R18n.locale(arr[0]), GlobalFilterList.instance
|
74
74
|
end
|
75
75
|
|
76
|
-
def method_missing(name, *
|
76
|
+
def method_missing(name, *_params)
|
77
77
|
# It is need to fix some hack in specs
|
78
78
|
if name == :to_ary
|
79
|
-
raise NoMethodError, "undefined method `to_ary' for #{
|
79
|
+
raise NoMethodError, "undefined method `to_ary' for #{self}"
|
80
80
|
end
|
81
81
|
|
82
82
|
self[name]
|
@@ -87,23 +87,25 @@ module R18n
|
|
87
87
|
@locale, @filters)
|
88
88
|
end
|
89
89
|
|
90
|
-
def |(
|
91
|
-
|
90
|
+
def |(other)
|
91
|
+
other
|
92
92
|
end
|
93
93
|
|
94
94
|
def to_s
|
95
|
-
@filters.process(
|
96
|
-
|
95
|
+
@filters.process(
|
96
|
+
:all, Untranslated, path, @locale, path,
|
97
|
+
[@translated_path, @untranslated_path, path]
|
98
|
+
)
|
97
99
|
end
|
98
100
|
|
99
|
-
alias
|
101
|
+
alias to_str to_s
|
100
102
|
|
101
103
|
# Is another locale has same code.
|
102
|
-
def ==(
|
103
|
-
return false unless
|
104
|
-
return false unless locale ==
|
105
|
-
return false unless translated_path ==
|
106
|
-
return false unless untranslated_path ==
|
104
|
+
def ==(other)
|
105
|
+
return false unless other.is_a? Untranslated
|
106
|
+
return false unless locale == other.locale
|
107
|
+
return false unless translated_path == other.translated_path
|
108
|
+
return false unless untranslated_path == other.untranslated_path
|
107
109
|
true
|
108
110
|
end
|
109
111
|
end
|