js-routes 2.2.7 → 2.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -9
- data/Gemfile +5 -0
- data/Readme.md +63 -47
- data/bin/tapioca +27 -0
- data/js-routes.gemspec +4 -1
- data/lib/js_routes/configuration.rb +80 -34
- data/lib/js_routes/engine.rb +2 -0
- data/lib/js_routes/generators/base.rb +15 -1
- data/lib/js_routes/generators/middleware.rb +3 -6
- data/lib/js_routes/generators/webpacker.rb +2 -4
- data/lib/js_routes/instance.rb +42 -15
- data/lib/js_routes/middleware.rb +14 -3
- data/lib/js_routes/route.rb +57 -16
- data/lib/js_routes/types.rb +28 -0
- data/lib/js_routes/version.rb +2 -1
- data/lib/js_routes.rb +20 -7
- data/lib/routes.js +25 -3
- data/lib/routes.ts +30 -6
- data/sorbet/config +4 -0
- data/sorbet/rbi/annotations/.gitattributes +1 -0
- data/sorbet/rbi/annotations/actionpack.rbi +428 -0
- data/sorbet/rbi/annotations/actionview.rbi +75 -0
- data/sorbet/rbi/annotations/activesupport.rbi +421 -0
- data/sorbet/rbi/annotations/railties.rbi +61 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/actionpack@7.0.4.1.rbi +303 -0
- data/sorbet/rbi/gems/actionview@7.0.4.1.rbi +8 -0
- data/sorbet/rbi/gems/activesupport@7.0.4.1.rbi +16424 -0
- data/sorbet/rbi/gems/appraisal@2.4.1.rbi +584 -0
- data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
- data/sorbet/rbi/gems/bump@0.10.0.rbi +168 -0
- data/sorbet/rbi/gems/byebug@11.1.3.rbi +3606 -0
- data/sorbet/rbi/gems/coderay@1.1.3.rbi +3426 -0
- data/sorbet/rbi/gems/concurrent-ruby@1.2.0.rbi +11570 -0
- data/sorbet/rbi/gems/crass@1.0.6.rbi +8 -0
- data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1083 -0
- data/sorbet/rbi/gems/erubi@1.12.0.rbi +145 -0
- data/sorbet/rbi/gems/i18n@1.12.0.rbi +2296 -0
- data/sorbet/rbi/gems/libv8-node@16.10.0.0.rbi +8 -0
- data/sorbet/rbi/gems/loofah@2.19.1.rbi +8 -0
- data/sorbet/rbi/gems/method_source@1.0.0.rbi +272 -0
- data/sorbet/rbi/gems/mini_racer@0.6.3.rbi +224 -0
- data/sorbet/rbi/gems/minitest@5.17.0.rbi +1457 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
- data/sorbet/rbi/gems/nokogiri@1.14.0.rbi +8 -0
- data/sorbet/rbi/gems/parallel@1.24.0.rbi +280 -0
- data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +951 -0
- data/sorbet/rbi/gems/prism@0.24.0.rbi +29744 -0
- data/sorbet/rbi/gems/pry-byebug@3.10.1.rbi +1150 -0
- data/sorbet/rbi/gems/pry@0.14.2.rbi +10075 -0
- data/sorbet/rbi/gems/racc@1.6.2.rbi +150 -0
- data/sorbet/rbi/gems/rack-test@2.0.2.rbi +8 -0
- data/sorbet/rbi/gems/rack@2.2.6.2.rbi +5585 -0
- data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +8 -0
- data/sorbet/rbi/gems/rails-html-sanitizer@1.5.0.rbi +8 -0
- data/sorbet/rbi/gems/railties@7.0.4.1.rbi +1959 -0
- data/sorbet/rbi/gems/rake@13.0.6.rbi +3072 -0
- data/sorbet/rbi/gems/rbi@0.1.9.rbi +3006 -0
- data/sorbet/rbi/gems/rspec-core@3.12.0.rbi +10868 -0
- data/sorbet/rbi/gems/rspec-expectations@3.12.2.rbi +8100 -0
- data/sorbet/rbi/gems/rspec-mocks@3.12.3.rbi +5299 -0
- data/sorbet/rbi/gems/rspec-support@3.12.0.rbi +1611 -0
- data/sorbet/rbi/gems/rspec@3.12.0.rbi +82 -0
- data/sorbet/rbi/gems/spoom@1.2.4.rbi +3777 -0
- data/sorbet/rbi/gems/sprockets-rails@3.4.2.rbi +14 -0
- data/sorbet/rbi/gems/sprockets@4.2.0.rbi +8 -0
- data/sorbet/rbi/gems/syntax_tree@6.2.0.rbi +23136 -0
- data/sorbet/rbi/gems/tapioca@0.12.0.rbi +3510 -0
- data/sorbet/rbi/gems/thor@1.2.1.rbi +3956 -0
- data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +5914 -0
- data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +428 -0
- data/sorbet/rbi/gems/yard@0.9.34.rbi +18332 -0
- data/sorbet/rbi/gems/zeitwerk@2.6.8.rbi +8 -0
- data/sorbet/rbi/todo.rbi +31 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +4 -0
- data/spec/js_routes/default_serializer_spec.rb +1 -1
- data/spec/js_routes/module_types/dts_spec.rb +17 -2
- data/spec/js_routes/module_types/umd_spec.rb +2 -2
- data/spec/js_routes/options_spec.rb +6 -6
- data/spec/js_routes/rails_routes_compatibility_spec.rb +17 -12
- data/spec/js_routes/route_specification_spec.rb +1 -4
- data/spec/js_routes/{zzz_last_post_rails_init_spec.rb → zzz_sprockets_spec.rb} +1 -1
- data/spec/spec_helper.rb +4 -0
- metadata +82 -7
@@ -0,0 +1,2296 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `i18n` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem i18n`.
|
6
|
+
|
7
|
+
# source://i18n//lib/i18n/gettext/po_parser.rb#15
|
8
|
+
module GetText; end
|
9
|
+
|
10
|
+
# source://i18n//lib/i18n/gettext/po_parser.rb#17
|
11
|
+
class GetText::PoParser < ::Racc::Parser
|
12
|
+
# source://i18n//lib/i18n/gettext/po_parser.rb#19
|
13
|
+
def _(x); end
|
14
|
+
|
15
|
+
def _reduce_10(val, _values, result); end
|
16
|
+
def _reduce_12(val, _values, result); end
|
17
|
+
def _reduce_13(val, _values, result); end
|
18
|
+
def _reduce_14(val, _values, result); end
|
19
|
+
def _reduce_15(val, _values, result); end
|
20
|
+
def _reduce_5(val, _values, result); end
|
21
|
+
def _reduce_8(val, _values, result); end
|
22
|
+
def _reduce_9(val, _values, result); end
|
23
|
+
|
24
|
+
# source://i18n//lib/i18n/gettext/po_parser.rb#323
|
25
|
+
def _reduce_none(val, _values, result); end
|
26
|
+
|
27
|
+
def next_token; end
|
28
|
+
def on_comment(comment); end
|
29
|
+
def on_message(msgid, msgstr); end
|
30
|
+
def parse(str, data, ignore_fuzzy = T.unsafe(nil)); end
|
31
|
+
def unescape(orig); end
|
32
|
+
end
|
33
|
+
|
34
|
+
# source://i18n//lib/i18n/gettext/po_parser.rb#184
|
35
|
+
GetText::PoParser::Racc_arg = T.let(T.unsafe(nil), Array)
|
36
|
+
|
37
|
+
# source://i18n//lib/i18n/gettext/po_parser.rb#221
|
38
|
+
GetText::PoParser::Racc_debug_parser = T.let(T.unsafe(nil), TrueClass)
|
39
|
+
|
40
|
+
# source://i18n//lib/i18n/gettext/po_parser.rb#200
|
41
|
+
GetText::PoParser::Racc_token_to_s_table = T.let(T.unsafe(nil), Array)
|
42
|
+
|
43
|
+
# Simple Locale tag implementation that computes subtags by simply splitting
|
44
|
+
# the locale tag at '-' occurrences.
|
45
|
+
#
|
46
|
+
# source://i18n//lib/i18n/version.rb#3
|
47
|
+
module I18n
|
48
|
+
extend ::I18n::Base
|
49
|
+
|
50
|
+
class << self
|
51
|
+
# source://i18n//lib/i18n/backend/cache.rb#64
|
52
|
+
def cache_key_digest; end
|
53
|
+
|
54
|
+
# source://i18n//lib/i18n/backend/cache.rb#68
|
55
|
+
def cache_key_digest=(key_digest); end
|
56
|
+
|
57
|
+
# source://i18n//lib/i18n/backend/cache.rb#56
|
58
|
+
def cache_namespace; end
|
59
|
+
|
60
|
+
# source://i18n//lib/i18n/backend/cache.rb#60
|
61
|
+
def cache_namespace=(namespace); end
|
62
|
+
|
63
|
+
# source://i18n//lib/i18n/backend/cache.rb#48
|
64
|
+
def cache_store; end
|
65
|
+
|
66
|
+
# source://i18n//lib/i18n/backend/cache.rb#52
|
67
|
+
def cache_store=(store); end
|
68
|
+
|
69
|
+
# Returns the current fallbacks implementation. Defaults to +I18n::Locale::Fallbacks+.
|
70
|
+
#
|
71
|
+
# source://i18n//lib/i18n/backend/fallbacks.rb#17
|
72
|
+
def fallbacks; end
|
73
|
+
|
74
|
+
# Sets the current fallbacks implementation. Use this to set a different fallbacks implementation.
|
75
|
+
#
|
76
|
+
# source://i18n//lib/i18n/backend/fallbacks.rb#23
|
77
|
+
def fallbacks=(fallbacks); end
|
78
|
+
|
79
|
+
# Return String or raises MissingInterpolationArgument exception.
|
80
|
+
# Missing argument's logic is handled by I18n.config.missing_interpolation_argument_handler.
|
81
|
+
#
|
82
|
+
# @raise [ReservedInterpolationKey]
|
83
|
+
#
|
84
|
+
# source://i18n//lib/i18n/interpolate/ruby.rb#16
|
85
|
+
def interpolate(string, values); end
|
86
|
+
|
87
|
+
# source://i18n//lib/i18n/interpolate/ruby.rb#22
|
88
|
+
def interpolate_hash(string, values); end
|
89
|
+
|
90
|
+
# source://i18n//lib/i18n.rb#37
|
91
|
+
def new_double_nested_cache; end
|
92
|
+
|
93
|
+
# @return [Boolean]
|
94
|
+
#
|
95
|
+
# source://i18n//lib/i18n/backend/cache.rb#72
|
96
|
+
def perform_caching?; end
|
97
|
+
|
98
|
+
# Marks a key as reserved. Reserved keys are used internally,
|
99
|
+
# and can't also be used for interpolation. If you are using any
|
100
|
+
# extra keys as I18n options, you should call I18n.reserve_key
|
101
|
+
# before any I18n.translate (etc) calls are made.
|
102
|
+
#
|
103
|
+
# source://i18n//lib/i18n.rb#45
|
104
|
+
def reserve_key(key); end
|
105
|
+
|
106
|
+
# source://i18n//lib/i18n.rb#50
|
107
|
+
def reserved_keys_pattern; end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
# source://i18n//lib/i18n/exceptions.rb#16
|
112
|
+
class I18n::ArgumentError < ::ArgumentError; end
|
113
|
+
|
114
|
+
# source://i18n//lib/i18n/backend.rb#4
|
115
|
+
module I18n::Backend; end
|
116
|
+
|
117
|
+
# source://i18n//lib/i18n/backend/base.rb#8
|
118
|
+
module I18n::Backend::Base
|
119
|
+
include ::I18n::Backend::Transliterator
|
120
|
+
|
121
|
+
# Returns an array of locales for which translations are available
|
122
|
+
# ignoring the reserved translation meta data key :i18n.
|
123
|
+
#
|
124
|
+
# @raise [NotImplementedError]
|
125
|
+
#
|
126
|
+
# source://i18n//lib/i18n/backend/base.rb#94
|
127
|
+
def available_locales; end
|
128
|
+
|
129
|
+
# source://i18n//lib/i18n/backend/base.rb#102
|
130
|
+
def eager_load!; end
|
131
|
+
|
132
|
+
# @return [Boolean]
|
133
|
+
#
|
134
|
+
# source://i18n//lib/i18n/backend/base.rb#68
|
135
|
+
def exists?(locale, key, options = T.unsafe(nil)); end
|
136
|
+
|
137
|
+
# Accepts a list of paths to translation files. Loads translations from
|
138
|
+
# plain Ruby (*.rb), YAML files (*.yml), or JSON files (*.json). See #load_rb, #load_yml, and #load_json
|
139
|
+
# for details.
|
140
|
+
#
|
141
|
+
# source://i18n//lib/i18n/backend/base.rb#14
|
142
|
+
def load_translations(*filenames); end
|
143
|
+
|
144
|
+
# Acts the same as +strftime+, but uses a localized version of the
|
145
|
+
# format string. Takes a key from the date/time formats translations as
|
146
|
+
# a format argument (<em>e.g.</em>, <tt>:short</tt> in <tt>:'date.formats'</tt>).
|
147
|
+
#
|
148
|
+
# @raise [ArgumentError]
|
149
|
+
#
|
150
|
+
# source://i18n//lib/i18n/backend/base.rb#75
|
151
|
+
def localize(locale, object, format = T.unsafe(nil), options = T.unsafe(nil)); end
|
152
|
+
|
153
|
+
# source://i18n//lib/i18n/backend/base.rb#98
|
154
|
+
def reload!; end
|
155
|
+
|
156
|
+
# This method receives a locale, a data hash and options for storing translations.
|
157
|
+
# Should be implemented
|
158
|
+
#
|
159
|
+
# @raise [NotImplementedError]
|
160
|
+
#
|
161
|
+
# source://i18n//lib/i18n/backend/base.rb#24
|
162
|
+
def store_translations(locale, data, options = T.unsafe(nil)); end
|
163
|
+
|
164
|
+
# @raise [I18n::ArgumentError]
|
165
|
+
#
|
166
|
+
# source://i18n//lib/i18n/backend/base.rb#28
|
167
|
+
def translate(locale, key, options = T.unsafe(nil)); end
|
168
|
+
|
169
|
+
protected
|
170
|
+
|
171
|
+
# Deep interpolation
|
172
|
+
#
|
173
|
+
# deep_interpolate { people: { ann: "Ann is %{ann}", john: "John is %{john}" } },
|
174
|
+
# ann: 'good', john: 'big'
|
175
|
+
# #=> { people: { ann: "Ann is good", john: "John is big" } }
|
176
|
+
#
|
177
|
+
# source://i18n//lib/i18n/backend/base.rb#202
|
178
|
+
def deep_interpolate(locale, data, values = T.unsafe(nil)); end
|
179
|
+
|
180
|
+
# Evaluates defaults.
|
181
|
+
# If given subject is an Array, it walks the array and returns the
|
182
|
+
# first translation that can be resolved. Otherwise it tries to resolve
|
183
|
+
# the translation directly.
|
184
|
+
#
|
185
|
+
# source://i18n//lib/i18n/backend/base.rb#125
|
186
|
+
def default(locale, object, subject, options = T.unsafe(nil)); end
|
187
|
+
|
188
|
+
# @return [Boolean]
|
189
|
+
#
|
190
|
+
# source://i18n//lib/i18n/backend/base.rb#108
|
191
|
+
def eager_loaded?; end
|
192
|
+
|
193
|
+
# Interpolates values into a given subject.
|
194
|
+
#
|
195
|
+
# if the given subject is a string then:
|
196
|
+
# method interpolates "file %{file} opened by %%{user}", :file => 'test.txt', :user => 'Mr. X'
|
197
|
+
# # => "file test.txt opened by %{user}"
|
198
|
+
#
|
199
|
+
# if the given subject is an array then:
|
200
|
+
# each element of the array is recursively interpolated (until it finds a string)
|
201
|
+
# method interpolates ["yes, %{user}", ["maybe no, %{user}, "no, %{user}"]], :user => "bartuz"
|
202
|
+
# # => "["yes, bartuz",["maybe no, bartuz", "no, bartuz"]]"
|
203
|
+
#
|
204
|
+
# source://i18n//lib/i18n/backend/base.rb#186
|
205
|
+
def interpolate(locale, subject, values = T.unsafe(nil)); end
|
206
|
+
|
207
|
+
# Loads a single translations file by delegating to #load_rb or
|
208
|
+
# #load_yml depending on the file extension and directly merges the
|
209
|
+
# data to the existing translations. Raises I18n::UnknownFileType
|
210
|
+
# for all other file extensions.
|
211
|
+
#
|
212
|
+
# @raise [UnknownFileType]
|
213
|
+
#
|
214
|
+
# source://i18n//lib/i18n/backend/base.rb#225
|
215
|
+
def load_file(filename); end
|
216
|
+
|
217
|
+
# Loads a JSON translations file. The data must have locales as
|
218
|
+
# toplevel keys.
|
219
|
+
#
|
220
|
+
# source://i18n//lib/i18n/backend/base.rb#261
|
221
|
+
def load_json(filename); end
|
222
|
+
|
223
|
+
# Loads a plain Ruby translations file. eval'ing the file must yield
|
224
|
+
# a Hash containing translation data with locales as toplevel keys.
|
225
|
+
#
|
226
|
+
# source://i18n//lib/i18n/backend/base.rb#239
|
227
|
+
def load_rb(filename); end
|
228
|
+
|
229
|
+
# Loads a YAML translations file. The data must have locales as
|
230
|
+
# toplevel keys.
|
231
|
+
#
|
232
|
+
# source://i18n//lib/i18n/backend/base.rb#246
|
233
|
+
def load_yaml(filename); end
|
234
|
+
|
235
|
+
# Loads a YAML translations file. The data must have locales as
|
236
|
+
# toplevel keys.
|
237
|
+
#
|
238
|
+
# source://i18n//lib/i18n/backend/base.rb#246
|
239
|
+
def load_yml(filename); end
|
240
|
+
|
241
|
+
# The method which actually looks up for the translation in the store.
|
242
|
+
#
|
243
|
+
# @raise [NotImplementedError]
|
244
|
+
#
|
245
|
+
# source://i18n//lib/i18n/backend/base.rb#113
|
246
|
+
def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end
|
247
|
+
|
248
|
+
# source://i18n//lib/i18n/backend/base.rb#293
|
249
|
+
def pluralization_key(entry, count); end
|
250
|
+
|
251
|
+
# Picks a translation from a pluralized mnemonic subkey according to English
|
252
|
+
# pluralization rules :
|
253
|
+
# - It will pick the :one subkey if count is equal to 1.
|
254
|
+
# - It will pick the :other subkey otherwise.
|
255
|
+
# - It will pick the :zero subkey in the special case where count is
|
256
|
+
# equal to 0 and there is a :zero subkey present. This behaviour is
|
257
|
+
# not standard with regards to the CLDR pluralization rules.
|
258
|
+
# Other backends can implement more flexible or complex pluralization rules.
|
259
|
+
#
|
260
|
+
# @raise [InvalidPluralizationData]
|
261
|
+
#
|
262
|
+
# source://i18n//lib/i18n/backend/base.rb#167
|
263
|
+
def pluralize(locale, entry, count); end
|
264
|
+
|
265
|
+
# Resolves a translation.
|
266
|
+
# If the given subject is a Symbol, it will be translated with the
|
267
|
+
# given options. If it is a Proc then it will be evaluated. All other
|
268
|
+
# subjects will be returned directly.
|
269
|
+
#
|
270
|
+
# source://i18n//lib/i18n/backend/base.rb#142
|
271
|
+
def resolve(locale, object, subject, options = T.unsafe(nil)); end
|
272
|
+
|
273
|
+
# Resolves a translation.
|
274
|
+
# If the given subject is a Symbol, it will be translated with the
|
275
|
+
# given options. If it is a Proc then it will be evaluated. All other
|
276
|
+
# subjects will be returned directly.
|
277
|
+
#
|
278
|
+
# source://i18n//lib/i18n/backend/base.rb#142
|
279
|
+
def resolve_entry(locale, object, subject, options = T.unsafe(nil)); end
|
280
|
+
|
281
|
+
# @return [Boolean]
|
282
|
+
#
|
283
|
+
# source://i18n//lib/i18n/backend/base.rb#117
|
284
|
+
def subtrees?; end
|
285
|
+
|
286
|
+
# source://i18n//lib/i18n/backend/base.rb#274
|
287
|
+
def translate_localization_format(locale, object, format, options); end
|
288
|
+
end
|
289
|
+
|
290
|
+
# TODO Should the cache be cleared if new translations are stored?
|
291
|
+
#
|
292
|
+
# source://i18n//lib/i18n/backend/cache.rb#79
|
293
|
+
module I18n::Backend::Cache
|
294
|
+
# source://i18n//lib/i18n/backend/cache.rb#80
|
295
|
+
def translate(locale, key, options = T.unsafe(nil)); end
|
296
|
+
|
297
|
+
protected
|
298
|
+
|
299
|
+
# source://i18n//lib/i18n/backend/cache.rb#93
|
300
|
+
def _fetch(cache_key, &block); end
|
301
|
+
|
302
|
+
# source://i18n//lib/i18n/backend/cache.rb#101
|
303
|
+
def cache_key(locale, key, options); end
|
304
|
+
|
305
|
+
# source://i18n//lib/i18n/backend/cache.rb#86
|
306
|
+
def fetch(cache_key, &block); end
|
307
|
+
|
308
|
+
private
|
309
|
+
|
310
|
+
# source://i18n//lib/i18n/backend/cache.rb#108
|
311
|
+
def digest_item(key); end
|
312
|
+
end
|
313
|
+
|
314
|
+
# Overwrites the Base load_file method to cache loaded file contents.
|
315
|
+
#
|
316
|
+
# source://i18n//lib/i18n/backend/cache_file.rb#8
|
317
|
+
module I18n::Backend::CacheFile
|
318
|
+
# Optionally provide path_roots array to normalize filename paths,
|
319
|
+
# to make the cached i18n data portable across environments.
|
320
|
+
#
|
321
|
+
# source://i18n//lib/i18n/backend/cache_file.rb#11
|
322
|
+
def path_roots; end
|
323
|
+
|
324
|
+
# Optionally provide path_roots array to normalize filename paths,
|
325
|
+
# to make the cached i18n data portable across environments.
|
326
|
+
#
|
327
|
+
# source://i18n//lib/i18n/backend/cache_file.rb#11
|
328
|
+
def path_roots=(_arg0); end
|
329
|
+
|
330
|
+
protected
|
331
|
+
|
332
|
+
# Track loaded translation files in the `i18n.load_file` scope,
|
333
|
+
# and skip loading the file if its contents are still up-to-date.
|
334
|
+
#
|
335
|
+
# source://i18n//lib/i18n/backend/cache_file.rb#17
|
336
|
+
def load_file(filename); end
|
337
|
+
|
338
|
+
# Translate absolute filename to relative path for i18n key.
|
339
|
+
#
|
340
|
+
# source://i18n//lib/i18n/backend/cache_file.rb#28
|
341
|
+
def normalized_path(file); end
|
342
|
+
end
|
343
|
+
|
344
|
+
# source://i18n//lib/i18n/backend/cascade.rb#35
|
345
|
+
module I18n::Backend::Cascade
|
346
|
+
# source://i18n//lib/i18n/backend/cascade.rb#36
|
347
|
+
def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end
|
348
|
+
end
|
349
|
+
|
350
|
+
# Backend that chains multiple other backends and checks each of them when
|
351
|
+
# a translation needs to be looked up. This is useful when you want to use
|
352
|
+
# standard translations with a Simple backend but store custom application
|
353
|
+
# translations in a database or other backends.
|
354
|
+
#
|
355
|
+
# To use the Chain backend instantiate it and set it to the I18n module.
|
356
|
+
# You can add chained backends through the initializer or backends
|
357
|
+
# accessor:
|
358
|
+
#
|
359
|
+
# # preserves the existing Simple backend set to I18n.backend
|
360
|
+
# I18n.backend = I18n::Backend::Chain.new(I18n::Backend::ActiveRecord.new, I18n.backend)
|
361
|
+
#
|
362
|
+
# The implementation assumes that all backends added to the Chain implement
|
363
|
+
# a lookup method with the same API as Simple backend does.
|
364
|
+
#
|
365
|
+
# source://i18n//lib/i18n/backend/chain.rb#19
|
366
|
+
class I18n::Backend::Chain
|
367
|
+
include ::I18n::Backend::Transliterator
|
368
|
+
include ::I18n::Backend::Base
|
369
|
+
include ::I18n::Backend::Chain::Implementation
|
370
|
+
end
|
371
|
+
|
372
|
+
# source://i18n//lib/i18n/backend/chain.rb#20
|
373
|
+
module I18n::Backend::Chain::Implementation
|
374
|
+
include ::I18n::Backend::Transliterator
|
375
|
+
include ::I18n::Backend::Base
|
376
|
+
|
377
|
+
# source://i18n//lib/i18n/backend/chain.rb#25
|
378
|
+
def initialize(*backends); end
|
379
|
+
|
380
|
+
# source://i18n//lib/i18n/backend/chain.rb#50
|
381
|
+
def available_locales; end
|
382
|
+
|
383
|
+
# Returns the value of attribute backends.
|
384
|
+
#
|
385
|
+
# source://i18n//lib/i18n/backend/chain.rb#23
|
386
|
+
def backends; end
|
387
|
+
|
388
|
+
# Sets the attribute backends
|
389
|
+
#
|
390
|
+
# @param value the value to set the attribute backends to.
|
391
|
+
#
|
392
|
+
# source://i18n//lib/i18n/backend/chain.rb#23
|
393
|
+
def backends=(_arg0); end
|
394
|
+
|
395
|
+
# source://i18n//lib/i18n/backend/chain.rb#42
|
396
|
+
def eager_load!; end
|
397
|
+
|
398
|
+
# @return [Boolean]
|
399
|
+
#
|
400
|
+
# source://i18n//lib/i18n/backend/chain.rb#74
|
401
|
+
def exists?(locale, key, options = T.unsafe(nil)); end
|
402
|
+
|
403
|
+
# @return [Boolean]
|
404
|
+
#
|
405
|
+
# source://i18n//lib/i18n/backend/chain.rb#29
|
406
|
+
def initialized?; end
|
407
|
+
|
408
|
+
# source://i18n//lib/i18n/backend/chain.rb#80
|
409
|
+
def localize(locale, object, format = T.unsafe(nil), options = T.unsafe(nil)); end
|
410
|
+
|
411
|
+
# source://i18n//lib/i18n/backend/chain.rb#38
|
412
|
+
def reload!; end
|
413
|
+
|
414
|
+
# source://i18n//lib/i18n/backend/chain.rb#46
|
415
|
+
def store_translations(locale, data, options = T.unsafe(nil)); end
|
416
|
+
|
417
|
+
# source://i18n//lib/i18n/backend/chain.rb#54
|
418
|
+
def translate(locale, key, default_options = T.unsafe(nil)); end
|
419
|
+
|
420
|
+
protected
|
421
|
+
|
422
|
+
# source://i18n//lib/i18n/backend/chain.rb#90
|
423
|
+
def init_translations; end
|
424
|
+
|
425
|
+
# @return [Boolean]
|
426
|
+
#
|
427
|
+
# source://i18n//lib/i18n/backend/chain.rb#106
|
428
|
+
def namespace_lookup?(result, options); end
|
429
|
+
|
430
|
+
# source://i18n//lib/i18n/backend/chain.rb#96
|
431
|
+
def translations; end
|
432
|
+
|
433
|
+
private
|
434
|
+
|
435
|
+
# This is approximately what gets used in ActiveSupport.
|
436
|
+
# However since we are not guaranteed to run in an ActiveSupport context
|
437
|
+
# it is wise to have our own copy. We underscore it
|
438
|
+
# to not pollute the namespace of the including class.
|
439
|
+
#
|
440
|
+
# source://i18n//lib/i18n/backend/chain.rb#115
|
441
|
+
def _deep_merge(hash, other_hash); end
|
442
|
+
end
|
443
|
+
|
444
|
+
# source://i18n//lib/i18n/backend/fallbacks.rb#30
|
445
|
+
module I18n::Backend::Fallbacks
|
446
|
+
# @return [Boolean]
|
447
|
+
#
|
448
|
+
# source://i18n//lib/i18n/backend/fallbacks.rb#94
|
449
|
+
def exists?(locale, key, options = T.unsafe(nil)); end
|
450
|
+
|
451
|
+
# source://i18n//lib/i18n/backend/fallbacks.rb#85
|
452
|
+
def extract_non_symbol_default!(options); end
|
453
|
+
|
454
|
+
# source://i18n//lib/i18n/backend/fallbacks.rb#67
|
455
|
+
def resolve_entry(locale, object, subject, options = T.unsafe(nil)); end
|
456
|
+
|
457
|
+
# Overwrites the Base backend translate method so that it will try each
|
458
|
+
# locale given by I18n.fallbacks for the given locale. E.g. for the
|
459
|
+
# locale :"de-DE" it might try the locales :"de-DE", :de and :en
|
460
|
+
# (depends on the fallbacks implementation) until it finds a result with
|
461
|
+
# the given options. If it does not find any result for any of the
|
462
|
+
# locales it will then throw MissingTranslation as usual.
|
463
|
+
#
|
464
|
+
# The default option takes precedence over fallback locales only when
|
465
|
+
# it's a Symbol. When the default contains a String, Proc or Hash
|
466
|
+
# it is evaluated last after all the fallback locales have been tried.
|
467
|
+
#
|
468
|
+
# source://i18n//lib/i18n/backend/fallbacks.rb#41
|
469
|
+
def translate(locale, key, options = T.unsafe(nil)); end
|
470
|
+
|
471
|
+
private
|
472
|
+
|
473
|
+
# Overwrite on_fallback to add specified logic when the fallback succeeds.
|
474
|
+
#
|
475
|
+
# source://i18n//lib/i18n/backend/fallbacks.rb#110
|
476
|
+
def on_fallback(_original_locale, _fallback_locale, _key, _options); end
|
477
|
+
end
|
478
|
+
|
479
|
+
# This module contains several helpers to assist flattening translations.
|
480
|
+
# You may want to flatten translations for:
|
481
|
+
#
|
482
|
+
# 1) speed up lookups, as in the Memoize backend;
|
483
|
+
# 2) In case you want to store translations in a data store, as in ActiveRecord backend;
|
484
|
+
#
|
485
|
+
# You can check both backends above for some examples.
|
486
|
+
# This module also keeps all links in a hash so they can be properly resolved when flattened.
|
487
|
+
#
|
488
|
+
# source://i18n//lib/i18n/backend/flatten.rb#13
|
489
|
+
module I18n::Backend::Flatten
|
490
|
+
# Flatten keys for nested Hashes by chaining up keys:
|
491
|
+
#
|
492
|
+
# >> { "a" => { "b" => { "c" => "d", "e" => "f" }, "g" => "h" }, "i" => "j"}.wind
|
493
|
+
# => { "a.b.c" => "d", "a.b.e" => "f", "a.g" => "h", "i" => "j" }
|
494
|
+
#
|
495
|
+
# source://i18n//lib/i18n/backend/flatten.rb#59
|
496
|
+
def flatten_keys(hash, escape, prev_key = T.unsafe(nil), &block); end
|
497
|
+
|
498
|
+
# Receives a hash of translations (where the key is a locale and
|
499
|
+
# the value is another hash) and return a hash with all
|
500
|
+
# translations flattened.
|
501
|
+
#
|
502
|
+
# Nested hashes are included in the flattened hash just if subtree
|
503
|
+
# is true and Symbols are automatically stored as links.
|
504
|
+
#
|
505
|
+
# source://i18n//lib/i18n/backend/flatten.rb#74
|
506
|
+
def flatten_translations(locale, data, escape, subtree); end
|
507
|
+
|
508
|
+
# Store flattened links.
|
509
|
+
#
|
510
|
+
# source://i18n//lib/i18n/backend/flatten.rb#50
|
511
|
+
def links; end
|
512
|
+
|
513
|
+
# Shortcut to I18n::Backend::Flatten.normalize_flat_keys
|
514
|
+
# and then resolve_links.
|
515
|
+
#
|
516
|
+
# source://i18n//lib/i18n/backend/flatten.rb#44
|
517
|
+
def normalize_flat_keys(locale, key, scope, separator); end
|
518
|
+
|
519
|
+
protected
|
520
|
+
|
521
|
+
# source://i18n//lib/i18n/backend/flatten.rb#112
|
522
|
+
def escape_default_separator(key); end
|
523
|
+
|
524
|
+
# source://i18n//lib/i18n/backend/flatten.rb#106
|
525
|
+
def find_link(locale, key); end
|
526
|
+
|
527
|
+
# source://i18n//lib/i18n/backend/flatten.rb#93
|
528
|
+
def resolve_link(locale, key); end
|
529
|
+
|
530
|
+
# source://i18n//lib/i18n/backend/flatten.rb#89
|
531
|
+
def store_link(locale, key, link); end
|
532
|
+
|
533
|
+
class << self
|
534
|
+
# Receives a string and escape the default separator.
|
535
|
+
#
|
536
|
+
# source://i18n//lib/i18n/backend/flatten.rb#38
|
537
|
+
def escape_default_separator(key); end
|
538
|
+
|
539
|
+
# normalize_keys the flatten way. This method is significantly faster
|
540
|
+
# and creates way less objects than the one at I18n.normalize_keys.
|
541
|
+
# It also handles escaping the translation keys.
|
542
|
+
#
|
543
|
+
# source://i18n//lib/i18n/backend/flatten.rb#20
|
544
|
+
def normalize_flat_keys(locale, key, scope, separator); end
|
545
|
+
end
|
546
|
+
end
|
547
|
+
|
548
|
+
# source://i18n//lib/i18n/backend/flatten.rb#15
|
549
|
+
I18n::Backend::Flatten::FLATTEN_SEPARATOR = T.let(T.unsafe(nil), String)
|
550
|
+
|
551
|
+
# source://i18n//lib/i18n/backend/flatten.rb#14
|
552
|
+
I18n::Backend::Flatten::SEPARATOR_ESCAPE_CHAR = T.let(T.unsafe(nil), String)
|
553
|
+
|
554
|
+
# Experimental support for using Gettext po files to store translations.
|
555
|
+
#
|
556
|
+
# To use this you can simply include the module to the Simple backend - or
|
557
|
+
# whatever other backend you are using.
|
558
|
+
#
|
559
|
+
# I18n::Backend::Simple.include(I18n::Backend::Gettext)
|
560
|
+
#
|
561
|
+
# Now you should be able to include your Gettext translation (*.po) files to
|
562
|
+
# the +I18n.load_path+ so they're loaded to the backend and you can use them as
|
563
|
+
# usual:
|
564
|
+
#
|
565
|
+
# I18n.load_path += Dir["path/to/locales/*.po"]
|
566
|
+
#
|
567
|
+
# Following the Gettext convention this implementation expects that your
|
568
|
+
# translation files are named by their locales. E.g. the file en.po would
|
569
|
+
# contain the translations for the English locale.
|
570
|
+
#
|
571
|
+
# To translate text <b>you must use</b> one of the translate methods provided by
|
572
|
+
# I18n::Gettext::Helpers.
|
573
|
+
#
|
574
|
+
# include I18n::Gettext::Helpers
|
575
|
+
# puts _("some string")
|
576
|
+
#
|
577
|
+
# Without it strings containing periods (".") will not be translated.
|
578
|
+
#
|
579
|
+
# source://i18n//lib/i18n/backend/gettext.rb#33
|
580
|
+
module I18n::Backend::Gettext
|
581
|
+
protected
|
582
|
+
|
583
|
+
# source://i18n//lib/i18n/backend/gettext.rb#41
|
584
|
+
def load_po(filename); end
|
585
|
+
|
586
|
+
# source://i18n//lib/i18n/backend/gettext.rb#51
|
587
|
+
def normalize(locale, data); end
|
588
|
+
|
589
|
+
# source://i18n//lib/i18n/backend/gettext.rb#68
|
590
|
+
def normalize_pluralization(locale, key, value); end
|
591
|
+
|
592
|
+
# source://i18n//lib/i18n/backend/gettext.rb#47
|
593
|
+
def parse(filename); end
|
594
|
+
end
|
595
|
+
|
596
|
+
# source://i18n//lib/i18n/backend/gettext.rb#34
|
597
|
+
class I18n::Backend::Gettext::PoData < ::Hash
|
598
|
+
# source://i18n//lib/i18n/backend/gettext.rb#35
|
599
|
+
def set_comment(msgid_or_sym, comment); end
|
600
|
+
end
|
601
|
+
|
602
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#20
|
603
|
+
module I18n::Backend::InterpolationCompiler
|
604
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#99
|
605
|
+
def interpolate(locale, string, values); end
|
606
|
+
|
607
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#109
|
608
|
+
def store_translations(locale, data, options = T.unsafe(nil)); end
|
609
|
+
|
610
|
+
protected
|
611
|
+
|
612
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#115
|
613
|
+
def compile_all_strings_in(data); end
|
614
|
+
end
|
615
|
+
|
616
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#21
|
617
|
+
module I18n::Backend::InterpolationCompiler::Compiler
|
618
|
+
extend ::I18n::Backend::InterpolationCompiler::Compiler
|
619
|
+
|
620
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#27
|
621
|
+
def compile_if_an_interpolation(string); end
|
622
|
+
|
623
|
+
# @return [Boolean]
|
624
|
+
#
|
625
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#39
|
626
|
+
def interpolated_str?(str); end
|
627
|
+
|
628
|
+
protected
|
629
|
+
|
630
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#60
|
631
|
+
def compile_interpolation_token(key); end
|
632
|
+
|
633
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#49
|
634
|
+
def compiled_interpolation_body(str); end
|
635
|
+
|
636
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#73
|
637
|
+
def direct_key(key); end
|
638
|
+
|
639
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#93
|
640
|
+
def escape_key_sym(key); end
|
641
|
+
|
642
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#89
|
643
|
+
def escape_plain_str(str); end
|
644
|
+
|
645
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#55
|
646
|
+
def handle_interpolation_token(interpolation, matchdata); end
|
647
|
+
|
648
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#69
|
649
|
+
def interpolate_key(key); end
|
650
|
+
|
651
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#64
|
652
|
+
def interpolate_or_raise_missing(key); end
|
653
|
+
|
654
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#81
|
655
|
+
def missing_key(key); end
|
656
|
+
|
657
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#77
|
658
|
+
def nil_key(key); end
|
659
|
+
|
660
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#85
|
661
|
+
def reserved_key(key); end
|
662
|
+
|
663
|
+
# tokenize("foo %{bar} baz %%{buz}") # => ["foo ", "%{bar}", " baz ", "%%{buz}"]
|
664
|
+
#
|
665
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#45
|
666
|
+
def tokenize(str); end
|
667
|
+
end
|
668
|
+
|
669
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#25
|
670
|
+
I18n::Backend::InterpolationCompiler::Compiler::INTERPOLATION_SYNTAX_PATTERN = T.let(T.unsafe(nil), Regexp)
|
671
|
+
|
672
|
+
# source://i18n//lib/i18n/backend/interpolation_compiler.rb#24
|
673
|
+
I18n::Backend::InterpolationCompiler::Compiler::TOKENIZER = T.let(T.unsafe(nil), Regexp)
|
674
|
+
|
675
|
+
# This is a basic backend for key value stores. It receives on
|
676
|
+
# initialization the store, which should respond to three methods:
|
677
|
+
#
|
678
|
+
# * store#[](key) - Used to get a value
|
679
|
+
# * store#[]=(key, value) - Used to set a value
|
680
|
+
# * store#keys - Used to get all keys
|
681
|
+
#
|
682
|
+
# Since these stores only supports string, all values are converted
|
683
|
+
# to JSON before being stored, allowing it to also store booleans,
|
684
|
+
# hashes and arrays. However, this store does not support Procs.
|
685
|
+
#
|
686
|
+
# As the ActiveRecord backend, Symbols are just supported when loading
|
687
|
+
# translations from the filesystem or through explicit store translations.
|
688
|
+
#
|
689
|
+
# Also, avoid calling I18n.available_locales since it's a somehow
|
690
|
+
# expensive operation in most stores.
|
691
|
+
#
|
692
|
+
# == Example
|
693
|
+
#
|
694
|
+
# To setup I18n to use TokyoCabinet in memory is quite straightforward:
|
695
|
+
#
|
696
|
+
# require 'rufus/tokyo/cabinet' # gem install rufus-tokyo
|
697
|
+
# I18n.backend = I18n::Backend::KeyValue.new(Rufus::Tokyo::Cabinet.new('*'))
|
698
|
+
#
|
699
|
+
# == Performance
|
700
|
+
#
|
701
|
+
# You may make this backend even faster by including the Memoize module.
|
702
|
+
# However, notice that you should properly clear the cache if you change
|
703
|
+
# values directly in the key-store.
|
704
|
+
#
|
705
|
+
# == Subtrees
|
706
|
+
#
|
707
|
+
# In most backends, you are allowed to retrieve part of a translation tree:
|
708
|
+
#
|
709
|
+
# I18n.backend.store_translations :en, :foo => { :bar => :baz }
|
710
|
+
# I18n.t "foo" #=> { :bar => :baz }
|
711
|
+
#
|
712
|
+
# This backend supports this feature by default, but it slows down the storage
|
713
|
+
# of new data considerably and makes hard to delete entries. That said, you are
|
714
|
+
# allowed to disable the storage of subtrees on initialization:
|
715
|
+
#
|
716
|
+
# I18n::Backend::KeyValue.new(@store, false)
|
717
|
+
#
|
718
|
+
# This is useful if you are using a KeyValue backend chained to a Simple backend.
|
719
|
+
#
|
720
|
+
# source://i18n//lib/i18n/backend/key_value.rb#69
|
721
|
+
class I18n::Backend::KeyValue
|
722
|
+
include ::I18n::Backend::Flatten
|
723
|
+
include ::I18n::Backend::Transliterator
|
724
|
+
include ::I18n::Backend::Base
|
725
|
+
include ::I18n::Backend::KeyValue::Implementation
|
726
|
+
end
|
727
|
+
|
728
|
+
# source://i18n//lib/i18n/backend/key_value.rb#70
|
729
|
+
module I18n::Backend::KeyValue::Implementation
|
730
|
+
include ::I18n::Backend::Flatten
|
731
|
+
include ::I18n::Backend::Transliterator
|
732
|
+
include ::I18n::Backend::Base
|
733
|
+
|
734
|
+
# source://i18n//lib/i18n/backend/key_value.rb#75
|
735
|
+
def initialize(store, subtrees = T.unsafe(nil)); end
|
736
|
+
|
737
|
+
# source://i18n//lib/i18n/backend/key_value.rb#102
|
738
|
+
def available_locales; end
|
739
|
+
|
740
|
+
# @return [Boolean]
|
741
|
+
#
|
742
|
+
# source://i18n//lib/i18n/backend/key_value.rb#79
|
743
|
+
def initialized?; end
|
744
|
+
|
745
|
+
# Returns the value of attribute store.
|
746
|
+
#
|
747
|
+
# source://i18n//lib/i18n/backend/key_value.rb#71
|
748
|
+
def store; end
|
749
|
+
|
750
|
+
# Sets the attribute store
|
751
|
+
#
|
752
|
+
# @param value the value to set the attribute store to.
|
753
|
+
#
|
754
|
+
# source://i18n//lib/i18n/backend/key_value.rb#71
|
755
|
+
def store=(_arg0); end
|
756
|
+
|
757
|
+
# source://i18n//lib/i18n/backend/key_value.rb#83
|
758
|
+
def store_translations(locale, data, options = T.unsafe(nil)); end
|
759
|
+
|
760
|
+
protected
|
761
|
+
|
762
|
+
# source://i18n//lib/i18n/backend/key_value.rb#124
|
763
|
+
def init_translations; end
|
764
|
+
|
765
|
+
# source://i18n//lib/i18n/backend/key_value.rb#136
|
766
|
+
def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end
|
767
|
+
|
768
|
+
# source://i18n//lib/i18n/backend/key_value.rb#150
|
769
|
+
def pluralize(locale, entry, count); end
|
770
|
+
|
771
|
+
# @return [Boolean]
|
772
|
+
#
|
773
|
+
# source://i18n//lib/i18n/backend/key_value.rb#132
|
774
|
+
def subtrees?; end
|
775
|
+
|
776
|
+
# Queries the translations from the key-value store and converts
|
777
|
+
# them into a hash such as the one returned from loading the
|
778
|
+
# haml files
|
779
|
+
#
|
780
|
+
# source://i18n//lib/i18n/backend/key_value.rb#115
|
781
|
+
def translations; end
|
782
|
+
end
|
783
|
+
|
784
|
+
# source://i18n//lib/i18n/backend/key_value.rb#161
|
785
|
+
class I18n::Backend::KeyValue::SubtreeProxy
|
786
|
+
# @return [SubtreeProxy] a new instance of SubtreeProxy
|
787
|
+
#
|
788
|
+
# source://i18n//lib/i18n/backend/key_value.rb#162
|
789
|
+
def initialize(master_key, store); end
|
790
|
+
|
791
|
+
# source://i18n//lib/i18n/backend/key_value.rb#172
|
792
|
+
def [](key); end
|
793
|
+
|
794
|
+
# @return [Boolean]
|
795
|
+
#
|
796
|
+
# source://i18n//lib/i18n/backend/key_value.rb#168
|
797
|
+
def has_key?(key); end
|
798
|
+
|
799
|
+
# source://i18n//lib/i18n/backend/key_value.rb#196
|
800
|
+
def inspect; end
|
801
|
+
|
802
|
+
# @return [Boolean]
|
803
|
+
#
|
804
|
+
# source://i18n//lib/i18n/backend/key_value.rb#188
|
805
|
+
def instance_of?(klass); end
|
806
|
+
|
807
|
+
# @return [Boolean]
|
808
|
+
#
|
809
|
+
# source://i18n//lib/i18n/backend/key_value.rb#183
|
810
|
+
def is_a?(klass); end
|
811
|
+
|
812
|
+
# @return [Boolean]
|
813
|
+
#
|
814
|
+
# source://i18n//lib/i18n/backend/key_value.rb#183
|
815
|
+
def kind_of?(klass); end
|
816
|
+
|
817
|
+
# @return [Boolean]
|
818
|
+
#
|
819
|
+
# source://i18n//lib/i18n/backend/key_value.rb#192
|
820
|
+
def nil?; end
|
821
|
+
end
|
822
|
+
|
823
|
+
# source://i18n//lib/i18n/backend/lazy_loadable.rb#65
|
824
|
+
class I18n::Backend::LazyLoadable < ::I18n::Backend::Simple
|
825
|
+
# @return [LazyLoadable] a new instance of LazyLoadable
|
826
|
+
#
|
827
|
+
# source://i18n//lib/i18n/backend/lazy_loadable.rb#66
|
828
|
+
def initialize(lazy_load: T.unsafe(nil)); end
|
829
|
+
|
830
|
+
# Parse the load path and extract all locales.
|
831
|
+
#
|
832
|
+
# source://i18n//lib/i18n/backend/lazy_loadable.rb#99
|
833
|
+
def available_locales; end
|
834
|
+
|
835
|
+
# Eager loading is not supported in the lazy context.
|
836
|
+
#
|
837
|
+
# source://i18n//lib/i18n/backend/lazy_loadable.rb#90
|
838
|
+
def eager_load!; end
|
839
|
+
|
840
|
+
# Returns whether the current locale is initialized.
|
841
|
+
#
|
842
|
+
# @return [Boolean]
|
843
|
+
#
|
844
|
+
# source://i18n//lib/i18n/backend/lazy_loadable.rb#71
|
845
|
+
def initialized?; end
|
846
|
+
|
847
|
+
# source://i18n//lib/i18n/backend/lazy_loadable.rb#107
|
848
|
+
def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end
|
849
|
+
|
850
|
+
# Clean up translations and uninitialize all locales.
|
851
|
+
#
|
852
|
+
# source://i18n//lib/i18n/backend/lazy_loadable.rb#80
|
853
|
+
def reload!; end
|
854
|
+
|
855
|
+
protected
|
856
|
+
|
857
|
+
# Load translations from files that belong to the current locale.
|
858
|
+
#
|
859
|
+
# @raise [InvalidFilenames]
|
860
|
+
#
|
861
|
+
# source://i18n//lib/i18n/backend/lazy_loadable.rb#121
|
862
|
+
def init_translations; end
|
863
|
+
|
864
|
+
# source://i18n//lib/i18n/backend/lazy_loadable.rb#133
|
865
|
+
def initialized_locales; end
|
866
|
+
|
867
|
+
private
|
868
|
+
|
869
|
+
# Checks if a filename is named in correspondence to the translations it loaded.
|
870
|
+
# The locale extracted from the path must be the single locale loaded in the translations.
|
871
|
+
#
|
872
|
+
# @raise [FilenameIncorrect]
|
873
|
+
#
|
874
|
+
# source://i18n//lib/i18n/backend/lazy_loadable.rb#175
|
875
|
+
def assert_file_named_correctly!(file, translations); end
|
876
|
+
|
877
|
+
# Select all files from I18n load path that belong to current locale.
|
878
|
+
# These files must start with the locale identifier (ie. "en", "pt-BR"),
|
879
|
+
# followed by an "_" demarcation to separate proceeding text.
|
880
|
+
#
|
881
|
+
# source://i18n//lib/i18n/backend/lazy_loadable.rb#167
|
882
|
+
def filenames_for_current_locale; end
|
883
|
+
|
884
|
+
# @return [Boolean]
|
885
|
+
#
|
886
|
+
# source://i18n//lib/i18n/backend/lazy_loadable.rb#139
|
887
|
+
def lazy_load?; end
|
888
|
+
|
889
|
+
# Loads each file supplied and asserts that the file only loads
|
890
|
+
# translations as expected by the name. The method returns a list of
|
891
|
+
# errors corresponding to offending files.
|
892
|
+
#
|
893
|
+
# source://i18n//lib/i18n/backend/lazy_loadable.rb#152
|
894
|
+
def load_translations_and_collect_file_errors(files); end
|
895
|
+
end
|
896
|
+
|
897
|
+
# source://i18n//lib/i18n/backend/lazy_loadable.rb#143
|
898
|
+
class I18n::Backend::LazyLoadable::FilenameIncorrect < ::StandardError
|
899
|
+
# @return [FilenameIncorrect] a new instance of FilenameIncorrect
|
900
|
+
#
|
901
|
+
# source://i18n//lib/i18n/backend/lazy_loadable.rb#144
|
902
|
+
def initialize(file, expected_locale, unexpected_locales); end
|
903
|
+
end
|
904
|
+
|
905
|
+
# Backend that lazy loads translations based on the current locale. This
|
906
|
+
# implementation avoids loading all translations up front. Instead, it only
|
907
|
+
# loads the translations that belong to the current locale. This offers a
|
908
|
+
# performance incentive in local development and test environments for
|
909
|
+
# applications with many translations for many different locales. It's
|
910
|
+
# particularly useful when the application only refers to a single locales'
|
911
|
+
# translations at a time (ex. A Rails workload). The implementation
|
912
|
+
# identifies which translation files from the load path belong to the
|
913
|
+
# current locale by pattern matching against their path name.
|
914
|
+
#
|
915
|
+
# Specifically, a translation file is considered to belong to a locale if:
|
916
|
+
# a) the filename is in the I18n load path
|
917
|
+
# b) the filename ends in a supported extension (ie. .yml, .json, .po, .rb)
|
918
|
+
# c) the filename starts with the locale identifier
|
919
|
+
# d) the locale identifier and optional proceeding text is separated by an underscore, ie. "_".
|
920
|
+
#
|
921
|
+
# Examples:
|
922
|
+
# Valid files that will be selected by this backend:
|
923
|
+
#
|
924
|
+
# "files/locales/en_translation.yml" (Selected for locale "en")
|
925
|
+
# "files/locales/fr.po" (Selected for locale "fr")
|
926
|
+
#
|
927
|
+
# Invalid files that won't be selected by this backend:
|
928
|
+
#
|
929
|
+
# "files/locales/translation-file"
|
930
|
+
# "files/locales/en-translation.unsupported"
|
931
|
+
# "files/locales/french/translation.yml"
|
932
|
+
# "files/locales/fr/translation.yml"
|
933
|
+
#
|
934
|
+
# The implementation uses this assumption to defer the loading of
|
935
|
+
# translation files until the current locale actually requires them.
|
936
|
+
#
|
937
|
+
# The backend has two working modes: lazy_load and eager_load.
|
938
|
+
#
|
939
|
+
# Note: This backend should only be enabled in test environments!
|
940
|
+
# When the mode is set to false, the backend behaves exactly like the
|
941
|
+
# Simple backend, with an additional check that the paths being loaded
|
942
|
+
# abide by the format. If paths can't be matched to the format, an error is raised.
|
943
|
+
#
|
944
|
+
# You can configure lazy loaded backends through the initializer or backends
|
945
|
+
# accessor:
|
946
|
+
#
|
947
|
+
# # In test environments
|
948
|
+
#
|
949
|
+
# I18n.backend = I18n::Backend::LazyLoadable.new(lazy_load: true)
|
950
|
+
#
|
951
|
+
# # In other environments, such as production and CI
|
952
|
+
#
|
953
|
+
# I18n.backend = I18n::Backend::LazyLoadable.new(lazy_load: false) # default
|
954
|
+
#
|
955
|
+
# source://i18n//lib/i18n/backend/lazy_loadable.rb#55
|
956
|
+
class I18n::Backend::LocaleExtractor
|
957
|
+
class << self
|
958
|
+
# source://i18n//lib/i18n/backend/lazy_loadable.rb#57
|
959
|
+
def locale_from_path(path); end
|
960
|
+
end
|
961
|
+
end
|
962
|
+
|
963
|
+
# source://i18n//lib/i18n/backend/memoize.rb#14
|
964
|
+
module I18n::Backend::Memoize
|
965
|
+
# source://i18n//lib/i18n/backend/memoize.rb#15
|
966
|
+
def available_locales; end
|
967
|
+
|
968
|
+
# source://i18n//lib/i18n/backend/memoize.rb#29
|
969
|
+
def eager_load!; end
|
970
|
+
|
971
|
+
# source://i18n//lib/i18n/backend/memoize.rb#24
|
972
|
+
def reload!; end
|
973
|
+
|
974
|
+
# source://i18n//lib/i18n/backend/memoize.rb#19
|
975
|
+
def store_translations(locale, data, options = T.unsafe(nil)); end
|
976
|
+
|
977
|
+
protected
|
978
|
+
|
979
|
+
# source://i18n//lib/i18n/backend/memoize.rb#37
|
980
|
+
def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end
|
981
|
+
|
982
|
+
# source://i18n//lib/i18n/backend/memoize.rb#44
|
983
|
+
def memoized_lookup; end
|
984
|
+
|
985
|
+
# source://i18n//lib/i18n/backend/memoize.rb#48
|
986
|
+
def reset_memoizations!(locale = T.unsafe(nil)); end
|
987
|
+
end
|
988
|
+
|
989
|
+
# source://i18n//lib/i18n/backend/metadata.rb#21
|
990
|
+
module I18n::Backend::Metadata
|
991
|
+
# source://i18n//lib/i18n/backend/metadata.rb#52
|
992
|
+
def interpolate(locale, entry, values = T.unsafe(nil)); end
|
993
|
+
|
994
|
+
# source://i18n//lib/i18n/backend/metadata.rb#57
|
995
|
+
def pluralize(locale, entry, count); end
|
996
|
+
|
997
|
+
# source://i18n//lib/i18n/backend/metadata.rb#40
|
998
|
+
def translate(locale, key, options = T.unsafe(nil)); end
|
999
|
+
|
1000
|
+
protected
|
1001
|
+
|
1002
|
+
# source://i18n//lib/i18n/backend/metadata.rb#63
|
1003
|
+
def with_metadata(metadata, &block); end
|
1004
|
+
|
1005
|
+
class << self
|
1006
|
+
# @private
|
1007
|
+
#
|
1008
|
+
# source://i18n//lib/i18n/backend/metadata.rb#23
|
1009
|
+
def included(base); end
|
1010
|
+
end
|
1011
|
+
end
|
1012
|
+
|
1013
|
+
# source://i18n//lib/i18n/backend/pluralization.rb#16
|
1014
|
+
module I18n::Backend::Pluralization
|
1015
|
+
# Overwrites the Base backend translate method so that it will check the
|
1016
|
+
# translation meta data space (:i18n) for a locale specific pluralization
|
1017
|
+
# rule and use it to pluralize the given entry. I.e. the library expects
|
1018
|
+
# pluralization rules to be stored at I18n.t(:'i18n.plural.rule')
|
1019
|
+
#
|
1020
|
+
# Pluralization rules are expected to respond to #call(count) and
|
1021
|
+
# return a pluralization key. Valid keys depend on the translation data
|
1022
|
+
# hash (entry) but it is generally recommended to follow CLDR's style,
|
1023
|
+
# i.e., return one of the keys :zero, :one, :few, :many, :other.
|
1024
|
+
#
|
1025
|
+
# The :zero key is always picked directly when count equals 0 AND the
|
1026
|
+
# translation data has the key :zero. This way translators are free to
|
1027
|
+
# either pick a special :zero translation even for languages where the
|
1028
|
+
# pluralizer does not return a :zero key.
|
1029
|
+
#
|
1030
|
+
# source://i18n//lib/i18n/backend/pluralization.rb#31
|
1031
|
+
def pluralize(locale, entry, count); end
|
1032
|
+
|
1033
|
+
protected
|
1034
|
+
|
1035
|
+
# source://i18n//lib/i18n/backend/pluralization.rb#50
|
1036
|
+
def pluralizer(locale); end
|
1037
|
+
|
1038
|
+
# source://i18n//lib/i18n/backend/pluralization.rb#46
|
1039
|
+
def pluralizers; end
|
1040
|
+
end
|
1041
|
+
|
1042
|
+
# A simple backend that reads translations from YAML files and stores them in
|
1043
|
+
# an in-memory hash. Relies on the Base backend.
|
1044
|
+
#
|
1045
|
+
# The implementation is provided by a Implementation module allowing to easily
|
1046
|
+
# extend Simple backend's behavior by including modules. E.g.:
|
1047
|
+
#
|
1048
|
+
# module I18n::Backend::Pluralization
|
1049
|
+
# def pluralize(*args)
|
1050
|
+
# # extended pluralization logic
|
1051
|
+
# super
|
1052
|
+
# end
|
1053
|
+
# end
|
1054
|
+
#
|
1055
|
+
# I18n::Backend::Simple.include(I18n::Backend::Pluralization)
|
1056
|
+
#
|
1057
|
+
# source://i18n//lib/i18n/backend/simple.rb#21
|
1058
|
+
class I18n::Backend::Simple
|
1059
|
+
include ::I18n::Backend::Transliterator
|
1060
|
+
include ::I18n::Backend::Base
|
1061
|
+
include ::I18n::Backend::Simple::Implementation
|
1062
|
+
end
|
1063
|
+
|
1064
|
+
# source://i18n//lib/i18n/backend/simple.rb#22
|
1065
|
+
module I18n::Backend::Simple::Implementation
|
1066
|
+
include ::I18n::Backend::Transliterator
|
1067
|
+
include ::I18n::Backend::Base
|
1068
|
+
|
1069
|
+
# Get available locales from the translations hash
|
1070
|
+
#
|
1071
|
+
# source://i18n//lib/i18n/backend/simple.rb#46
|
1072
|
+
def available_locales; end
|
1073
|
+
|
1074
|
+
# source://i18n//lib/i18n/backend/simple.rb#61
|
1075
|
+
def eager_load!; end
|
1076
|
+
|
1077
|
+
# @return [Boolean]
|
1078
|
+
#
|
1079
|
+
# source://i18n//lib/i18n/backend/simple.rb#25
|
1080
|
+
def initialized?; end
|
1081
|
+
|
1082
|
+
# Clean up translations hash and set initialized to false on reload!
|
1083
|
+
#
|
1084
|
+
# source://i18n//lib/i18n/backend/simple.rb#55
|
1085
|
+
def reload!; end
|
1086
|
+
|
1087
|
+
# Stores translations for the given locale in memory.
|
1088
|
+
# This uses a deep merge for the translations hash, so existing
|
1089
|
+
# translations will be overwritten by new ones only at the deepest
|
1090
|
+
# level of the hash.
|
1091
|
+
#
|
1092
|
+
# source://i18n//lib/i18n/backend/simple.rb#33
|
1093
|
+
def store_translations(locale, data, options = T.unsafe(nil)); end
|
1094
|
+
|
1095
|
+
# source://i18n//lib/i18n/backend/simple.rb#66
|
1096
|
+
def translations(do_init: T.unsafe(nil)); end
|
1097
|
+
|
1098
|
+
protected
|
1099
|
+
|
1100
|
+
# source://i18n//lib/i18n/backend/simple.rb#76
|
1101
|
+
def init_translations; end
|
1102
|
+
|
1103
|
+
# Looks up a translation from the translations hash. Returns nil if
|
1104
|
+
# either key is nil, or locale, scope or key do not exist as a key in the
|
1105
|
+
# nested translations hash. Splits keys or scopes containing dots
|
1106
|
+
# into multiple keys, i.e. <tt>currency.format</tt> is regarded the same as
|
1107
|
+
# <tt>%w(currency format)</tt>.
|
1108
|
+
#
|
1109
|
+
# source://i18n//lib/i18n/backend/simple.rb#86
|
1110
|
+
def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end
|
1111
|
+
end
|
1112
|
+
|
1113
|
+
# source://i18n//lib/i18n/backend/transliterator.rb#6
|
1114
|
+
module I18n::Backend::Transliterator
|
1115
|
+
# Given a locale and a UTF-8 string, return the locale's ASCII
|
1116
|
+
# approximation for the string.
|
1117
|
+
#
|
1118
|
+
# source://i18n//lib/i18n/backend/transliterator.rb#11
|
1119
|
+
def transliterate(locale, string, replacement = T.unsafe(nil)); end
|
1120
|
+
|
1121
|
+
class << self
|
1122
|
+
# Get a transliterator instance.
|
1123
|
+
#
|
1124
|
+
# source://i18n//lib/i18n/backend/transliterator.rb#19
|
1125
|
+
def get(rule = T.unsafe(nil)); end
|
1126
|
+
end
|
1127
|
+
end
|
1128
|
+
|
1129
|
+
# source://i18n//lib/i18n/backend/transliterator.rb#7
|
1130
|
+
I18n::Backend::Transliterator::DEFAULT_REPLACEMENT_CHAR = T.let(T.unsafe(nil), String)
|
1131
|
+
|
1132
|
+
# A transliterator which accepts a Hash of characters as its translation
|
1133
|
+
# rule.
|
1134
|
+
#
|
1135
|
+
# source://i18n//lib/i18n/backend/transliterator.rb#42
|
1136
|
+
class I18n::Backend::Transliterator::HashTransliterator
|
1137
|
+
# @return [HashTransliterator] a new instance of HashTransliterator
|
1138
|
+
#
|
1139
|
+
# source://i18n//lib/i18n/backend/transliterator.rb#74
|
1140
|
+
def initialize(rule = T.unsafe(nil)); end
|
1141
|
+
|
1142
|
+
# source://i18n//lib/i18n/backend/transliterator.rb#80
|
1143
|
+
def transliterate(string, replacement = T.unsafe(nil)); end
|
1144
|
+
|
1145
|
+
private
|
1146
|
+
|
1147
|
+
# Add transliteration rules to the approximations hash.
|
1148
|
+
#
|
1149
|
+
# source://i18n//lib/i18n/backend/transliterator.rb#100
|
1150
|
+
def add(hash); end
|
1151
|
+
|
1152
|
+
# source://i18n//lib/i18n/backend/transliterator.rb#93
|
1153
|
+
def add_default_approximations; end
|
1154
|
+
|
1155
|
+
# source://i18n//lib/i18n/backend/transliterator.rb#89
|
1156
|
+
def approximations; end
|
1157
|
+
end
|
1158
|
+
|
1159
|
+
# source://i18n//lib/i18n/backend/transliterator.rb#43
|
1160
|
+
I18n::Backend::Transliterator::HashTransliterator::DEFAULT_APPROXIMATIONS = T.let(T.unsafe(nil), Hash)
|
1161
|
+
|
1162
|
+
# A transliterator which accepts a Proc as its transliteration rule.
|
1163
|
+
#
|
1164
|
+
# source://i18n//lib/i18n/backend/transliterator.rb#30
|
1165
|
+
class I18n::Backend::Transliterator::ProcTransliterator
|
1166
|
+
# @return [ProcTransliterator] a new instance of ProcTransliterator
|
1167
|
+
#
|
1168
|
+
# source://i18n//lib/i18n/backend/transliterator.rb#31
|
1169
|
+
def initialize(rule); end
|
1170
|
+
|
1171
|
+
# source://i18n//lib/i18n/backend/transliterator.rb#35
|
1172
|
+
def transliterate(string, replacement = T.unsafe(nil)); end
|
1173
|
+
end
|
1174
|
+
|
1175
|
+
# source://i18n//lib/i18n.rb#54
|
1176
|
+
module I18n::Base
|
1177
|
+
# source://i18n//lib/i18n.rb#69
|
1178
|
+
def available_locales; end
|
1179
|
+
|
1180
|
+
# source://i18n//lib/i18n.rb#73
|
1181
|
+
def available_locales=(value); end
|
1182
|
+
|
1183
|
+
# @return [Boolean]
|
1184
|
+
#
|
1185
|
+
# source://i18n//lib/i18n.rb#355
|
1186
|
+
def available_locales_initialized?; end
|
1187
|
+
|
1188
|
+
# source://i18n//lib/i18n.rb#69
|
1189
|
+
def backend; end
|
1190
|
+
|
1191
|
+
# source://i18n//lib/i18n.rb#73
|
1192
|
+
def backend=(value); end
|
1193
|
+
|
1194
|
+
# Gets I18n configuration object.
|
1195
|
+
#
|
1196
|
+
# source://i18n//lib/i18n.rb#56
|
1197
|
+
def config; end
|
1198
|
+
|
1199
|
+
# Sets I18n configuration object.
|
1200
|
+
#
|
1201
|
+
# source://i18n//lib/i18n.rb#61
|
1202
|
+
def config=(value); end
|
1203
|
+
|
1204
|
+
# source://i18n//lib/i18n.rb#69
|
1205
|
+
def default_locale; end
|
1206
|
+
|
1207
|
+
# source://i18n//lib/i18n.rb#73
|
1208
|
+
def default_locale=(value); end
|
1209
|
+
|
1210
|
+
# source://i18n//lib/i18n.rb#69
|
1211
|
+
def default_separator; end
|
1212
|
+
|
1213
|
+
# source://i18n//lib/i18n.rb#73
|
1214
|
+
def default_separator=(value); end
|
1215
|
+
|
1216
|
+
# Tells the backend to load translations now. Used in situations like the
|
1217
|
+
# Rails production environment. Backends can implement whatever strategy
|
1218
|
+
# is useful.
|
1219
|
+
#
|
1220
|
+
# source://i18n//lib/i18n.rb#90
|
1221
|
+
def eager_load!; end
|
1222
|
+
|
1223
|
+
# source://i18n//lib/i18n.rb#69
|
1224
|
+
def enforce_available_locales; end
|
1225
|
+
|
1226
|
+
# Raises an InvalidLocale exception when the passed locale is not available.
|
1227
|
+
#
|
1228
|
+
# source://i18n//lib/i18n.rb#349
|
1229
|
+
def enforce_available_locales!(locale); end
|
1230
|
+
|
1231
|
+
# source://i18n//lib/i18n.rb#73
|
1232
|
+
def enforce_available_locales=(value); end
|
1233
|
+
|
1234
|
+
# source://i18n//lib/i18n.rb#69
|
1235
|
+
def exception_handler; end
|
1236
|
+
|
1237
|
+
# source://i18n//lib/i18n.rb#73
|
1238
|
+
def exception_handler=(value); end
|
1239
|
+
|
1240
|
+
# Returns true if a translation exists for a given key, otherwise returns false.
|
1241
|
+
#
|
1242
|
+
# @raise [Disabled]
|
1243
|
+
# @return [Boolean]
|
1244
|
+
#
|
1245
|
+
# source://i18n//lib/i18n.rb#235
|
1246
|
+
def exists?(key, _locale = T.unsafe(nil), locale: T.unsafe(nil), **options); end
|
1247
|
+
|
1248
|
+
# Localizes certain objects, such as dates and numbers to local formatting.
|
1249
|
+
#
|
1250
|
+
# @raise [Disabled]
|
1251
|
+
#
|
1252
|
+
# source://i18n//lib/i18n.rb#304
|
1253
|
+
def l(object, locale: T.unsafe(nil), format: T.unsafe(nil), **options); end
|
1254
|
+
|
1255
|
+
# source://i18n//lib/i18n.rb#69
|
1256
|
+
def load_path; end
|
1257
|
+
|
1258
|
+
# source://i18n//lib/i18n.rb#73
|
1259
|
+
def load_path=(value); end
|
1260
|
+
|
1261
|
+
# source://i18n//lib/i18n.rb#69
|
1262
|
+
def locale; end
|
1263
|
+
|
1264
|
+
# source://i18n//lib/i18n.rb#73
|
1265
|
+
def locale=(value); end
|
1266
|
+
|
1267
|
+
# Returns true when the passed locale, which can be either a String or a
|
1268
|
+
# Symbol, is in the list of available locales. Returns false otherwise.
|
1269
|
+
#
|
1270
|
+
# @return [Boolean]
|
1271
|
+
#
|
1272
|
+
# source://i18n//lib/i18n.rb#344
|
1273
|
+
def locale_available?(locale); end
|
1274
|
+
|
1275
|
+
# Localizes certain objects, such as dates and numbers to local formatting.
|
1276
|
+
#
|
1277
|
+
# @raise [Disabled]
|
1278
|
+
#
|
1279
|
+
# source://i18n//lib/i18n.rb#304
|
1280
|
+
def localize(object, locale: T.unsafe(nil), format: T.unsafe(nil), **options); end
|
1281
|
+
|
1282
|
+
# Merges the given locale, key and scope into a single array of keys.
|
1283
|
+
# Splits keys that contain dots into multiple keys. Makes sure all
|
1284
|
+
# keys are Symbols.
|
1285
|
+
#
|
1286
|
+
# source://i18n//lib/i18n.rb#332
|
1287
|
+
def normalize_keys(locale, key, scope, separator = T.unsafe(nil)); end
|
1288
|
+
|
1289
|
+
# Tells the backend to reload translations. Used in situations like the
|
1290
|
+
# Rails development environment. Backends can implement whatever strategy
|
1291
|
+
# is useful.
|
1292
|
+
#
|
1293
|
+
# source://i18n//lib/i18n.rb#82
|
1294
|
+
def reload!; end
|
1295
|
+
|
1296
|
+
# Translates, pluralizes and interpolates a given key using a given locale,
|
1297
|
+
# scope, and default, as well as interpolation values.
|
1298
|
+
#
|
1299
|
+
# *LOOKUP*
|
1300
|
+
#
|
1301
|
+
# Translation data is organized as a nested hash using the upper-level keys
|
1302
|
+
# as namespaces. <em>E.g.</em>, ActionView ships with the translation:
|
1303
|
+
# <tt>:date => {:formats => {:short => "%b %d"}}</tt>.
|
1304
|
+
#
|
1305
|
+
# Translations can be looked up at any level of this hash using the key argument
|
1306
|
+
# and the scope option. <em>E.g.</em>, in this example <tt>I18n.t :date</tt>
|
1307
|
+
# returns the whole translations hash <tt>{:formats => {:short => "%b %d"}}</tt>.
|
1308
|
+
#
|
1309
|
+
# Key can be either a single key or a dot-separated key (both Strings and Symbols
|
1310
|
+
# work). <em>E.g.</em>, the short format can be looked up using both:
|
1311
|
+
# I18n.t 'date.formats.short'
|
1312
|
+
# I18n.t :'date.formats.short'
|
1313
|
+
#
|
1314
|
+
# Scope can be either a single key, a dot-separated key or an array of keys
|
1315
|
+
# or dot-separated keys. Keys and scopes can be combined freely. So these
|
1316
|
+
# examples will all look up the same short date format:
|
1317
|
+
# I18n.t 'date.formats.short'
|
1318
|
+
# I18n.t 'formats.short', :scope => 'date'
|
1319
|
+
# I18n.t 'short', :scope => 'date.formats'
|
1320
|
+
# I18n.t 'short', :scope => %w(date formats)
|
1321
|
+
#
|
1322
|
+
# *INTERPOLATION*
|
1323
|
+
#
|
1324
|
+
# Translations can contain interpolation variables which will be replaced by
|
1325
|
+
# values passed to #translate as part of the options hash, with the keys matching
|
1326
|
+
# the interpolation variable names.
|
1327
|
+
#
|
1328
|
+
# <em>E.g.</em>, with a translation <tt>:foo => "foo %{bar}"</tt> the option
|
1329
|
+
# value for the key +bar+ will be interpolated into the translation:
|
1330
|
+
# I18n.t :foo, :bar => 'baz' # => 'foo baz'
|
1331
|
+
#
|
1332
|
+
# *PLURALIZATION*
|
1333
|
+
#
|
1334
|
+
# Translation data can contain pluralized translations. Pluralized translations
|
1335
|
+
# are arrays of singular/plural versions of translations like <tt>['Foo', 'Foos']</tt>.
|
1336
|
+
#
|
1337
|
+
# Note that <tt>I18n::Backend::Simple</tt> only supports an algorithm for English
|
1338
|
+
# pluralization rules. Other algorithms can be supported by custom backends.
|
1339
|
+
#
|
1340
|
+
# This returns the singular version of a pluralized translation:
|
1341
|
+
# I18n.t :foo, :count => 1 # => 'Foo'
|
1342
|
+
#
|
1343
|
+
# These both return the plural version of a pluralized translation:
|
1344
|
+
# I18n.t :foo, :count => 0 # => 'Foos'
|
1345
|
+
# I18n.t :foo, :count => 2 # => 'Foos'
|
1346
|
+
#
|
1347
|
+
# The <tt>:count</tt> option can be used both for pluralization and interpolation.
|
1348
|
+
# <em>E.g.</em>, with the translation
|
1349
|
+
# <tt>:foo => ['%{count} foo', '%{count} foos']</tt>, count will
|
1350
|
+
# be interpolated to the pluralized translation:
|
1351
|
+
# I18n.t :foo, :count => 1 # => '1 foo'
|
1352
|
+
#
|
1353
|
+
# *DEFAULTS*
|
1354
|
+
#
|
1355
|
+
# This returns the translation for <tt>:foo</tt> or <tt>default</tt> if no translation was found:
|
1356
|
+
# I18n.t :foo, :default => 'default'
|
1357
|
+
#
|
1358
|
+
# This returns the translation for <tt>:foo</tt> or the translation for <tt>:bar</tt> if no
|
1359
|
+
# translation for <tt>:foo</tt> was found:
|
1360
|
+
# I18n.t :foo, :default => :bar
|
1361
|
+
#
|
1362
|
+
# Returns the translation for <tt>:foo</tt> or the translation for <tt>:bar</tt>
|
1363
|
+
# or <tt>default</tt> if no translations for <tt>:foo</tt> and <tt>:bar</tt> were found.
|
1364
|
+
# I18n.t :foo, :default => [:bar, 'default']
|
1365
|
+
#
|
1366
|
+
# *BULK LOOKUP*
|
1367
|
+
#
|
1368
|
+
# This returns an array with the translations for <tt>:foo</tt> and <tt>:bar</tt>.
|
1369
|
+
# I18n.t [:foo, :bar]
|
1370
|
+
#
|
1371
|
+
# Can be used with dot-separated nested keys:
|
1372
|
+
# I18n.t [:'baz.foo', :'baz.bar']
|
1373
|
+
#
|
1374
|
+
# Which is the same as using a scope option:
|
1375
|
+
# I18n.t [:foo, :bar], :scope => :baz
|
1376
|
+
#
|
1377
|
+
# *LAMBDAS*
|
1378
|
+
#
|
1379
|
+
# Both translations and defaults can be given as Ruby lambdas. Lambdas will be
|
1380
|
+
# called and passed the key and options.
|
1381
|
+
#
|
1382
|
+
# E.g. assuming the key <tt>:salutation</tt> resolves to:
|
1383
|
+
# lambda { |key, options| options[:gender] == 'm' ? "Mr. #{options[:name]}" : "Mrs. #{options[:name]}" }
|
1384
|
+
#
|
1385
|
+
# Then <tt>I18n.t(:salutation, :gender => 'w', :name => 'Smith') will result in "Mrs. Smith".
|
1386
|
+
#
|
1387
|
+
# Note that the string returned by lambda will go through string interpolation too,
|
1388
|
+
# so the following lambda would give the same result:
|
1389
|
+
# lambda { |key, options| options[:gender] == 'm' ? "Mr. %{name}" : "Mrs. %{name}" }
|
1390
|
+
#
|
1391
|
+
# It is recommended to use/implement lambdas in an "idempotent" way. E.g. when
|
1392
|
+
# a cache layer is put in front of I18n.translate it will generate a cache key
|
1393
|
+
# from the argument values passed to #translate. Therefore your lambdas should
|
1394
|
+
# always return the same translations/values per unique combination of argument
|
1395
|
+
# values.
|
1396
|
+
#
|
1397
|
+
# *Ruby 2.7+ keyword arguments warning*
|
1398
|
+
#
|
1399
|
+
# This method uses keyword arguments.
|
1400
|
+
# There is a breaking change in ruby that produces warning with ruby 2.7 and won't work as expected with ruby 3.0
|
1401
|
+
# The "hash" parameter must be passed as keyword argument.
|
1402
|
+
#
|
1403
|
+
# Good:
|
1404
|
+
# I18n.t(:salutation, :gender => 'w', :name => 'Smith')
|
1405
|
+
# I18n.t(:salutation, **{ :gender => 'w', :name => 'Smith' })
|
1406
|
+
# I18n.t(:salutation, **any_hash)
|
1407
|
+
#
|
1408
|
+
# Bad:
|
1409
|
+
# I18n.t(:salutation, { :gender => 'w', :name => 'Smith' })
|
1410
|
+
# I18n.t(:salutation, any_hash)
|
1411
|
+
#
|
1412
|
+
# @raise [Disabled]
|
1413
|
+
#
|
1414
|
+
# source://i18n//lib/i18n.rb#210
|
1415
|
+
def t(key = T.unsafe(nil), throw: T.unsafe(nil), raise: T.unsafe(nil), locale: T.unsafe(nil), **options); end
|
1416
|
+
|
1417
|
+
# Wrapper for <tt>translate</tt> that adds <tt>:raise => true</tt>. With
|
1418
|
+
# this option, if no translation is found, it will raise <tt>I18n::MissingTranslationData</tt>
|
1419
|
+
#
|
1420
|
+
# source://i18n//lib/i18n.rb#229
|
1421
|
+
def t!(key, **options); end
|
1422
|
+
|
1423
|
+
# Translates, pluralizes and interpolates a given key using a given locale,
|
1424
|
+
# scope, and default, as well as interpolation values.
|
1425
|
+
#
|
1426
|
+
# *LOOKUP*
|
1427
|
+
#
|
1428
|
+
# Translation data is organized as a nested hash using the upper-level keys
|
1429
|
+
# as namespaces. <em>E.g.</em>, ActionView ships with the translation:
|
1430
|
+
# <tt>:date => {:formats => {:short => "%b %d"}}</tt>.
|
1431
|
+
#
|
1432
|
+
# Translations can be looked up at any level of this hash using the key argument
|
1433
|
+
# and the scope option. <em>E.g.</em>, in this example <tt>I18n.t :date</tt>
|
1434
|
+
# returns the whole translations hash <tt>{:formats => {:short => "%b %d"}}</tt>.
|
1435
|
+
#
|
1436
|
+
# Key can be either a single key or a dot-separated key (both Strings and Symbols
|
1437
|
+
# work). <em>E.g.</em>, the short format can be looked up using both:
|
1438
|
+
# I18n.t 'date.formats.short'
|
1439
|
+
# I18n.t :'date.formats.short'
|
1440
|
+
#
|
1441
|
+
# Scope can be either a single key, a dot-separated key or an array of keys
|
1442
|
+
# or dot-separated keys. Keys and scopes can be combined freely. So these
|
1443
|
+
# examples will all look up the same short date format:
|
1444
|
+
# I18n.t 'date.formats.short'
|
1445
|
+
# I18n.t 'formats.short', :scope => 'date'
|
1446
|
+
# I18n.t 'short', :scope => 'date.formats'
|
1447
|
+
# I18n.t 'short', :scope => %w(date formats)
|
1448
|
+
#
|
1449
|
+
# *INTERPOLATION*
|
1450
|
+
#
|
1451
|
+
# Translations can contain interpolation variables which will be replaced by
|
1452
|
+
# values passed to #translate as part of the options hash, with the keys matching
|
1453
|
+
# the interpolation variable names.
|
1454
|
+
#
|
1455
|
+
# <em>E.g.</em>, with a translation <tt>:foo => "foo %{bar}"</tt> the option
|
1456
|
+
# value for the key +bar+ will be interpolated into the translation:
|
1457
|
+
# I18n.t :foo, :bar => 'baz' # => 'foo baz'
|
1458
|
+
#
|
1459
|
+
# *PLURALIZATION*
|
1460
|
+
#
|
1461
|
+
# Translation data can contain pluralized translations. Pluralized translations
|
1462
|
+
# are arrays of singular/plural versions of translations like <tt>['Foo', 'Foos']</tt>.
|
1463
|
+
#
|
1464
|
+
# Note that <tt>I18n::Backend::Simple</tt> only supports an algorithm for English
|
1465
|
+
# pluralization rules. Other algorithms can be supported by custom backends.
|
1466
|
+
#
|
1467
|
+
# This returns the singular version of a pluralized translation:
|
1468
|
+
# I18n.t :foo, :count => 1 # => 'Foo'
|
1469
|
+
#
|
1470
|
+
# These both return the plural version of a pluralized translation:
|
1471
|
+
# I18n.t :foo, :count => 0 # => 'Foos'
|
1472
|
+
# I18n.t :foo, :count => 2 # => 'Foos'
|
1473
|
+
#
|
1474
|
+
# The <tt>:count</tt> option can be used both for pluralization and interpolation.
|
1475
|
+
# <em>E.g.</em>, with the translation
|
1476
|
+
# <tt>:foo => ['%{count} foo', '%{count} foos']</tt>, count will
|
1477
|
+
# be interpolated to the pluralized translation:
|
1478
|
+
# I18n.t :foo, :count => 1 # => '1 foo'
|
1479
|
+
#
|
1480
|
+
# *DEFAULTS*
|
1481
|
+
#
|
1482
|
+
# This returns the translation for <tt>:foo</tt> or <tt>default</tt> if no translation was found:
|
1483
|
+
# I18n.t :foo, :default => 'default'
|
1484
|
+
#
|
1485
|
+
# This returns the translation for <tt>:foo</tt> or the translation for <tt>:bar</tt> if no
|
1486
|
+
# translation for <tt>:foo</tt> was found:
|
1487
|
+
# I18n.t :foo, :default => :bar
|
1488
|
+
#
|
1489
|
+
# Returns the translation for <tt>:foo</tt> or the translation for <tt>:bar</tt>
|
1490
|
+
# or <tt>default</tt> if no translations for <tt>:foo</tt> and <tt>:bar</tt> were found.
|
1491
|
+
# I18n.t :foo, :default => [:bar, 'default']
|
1492
|
+
#
|
1493
|
+
# *BULK LOOKUP*
|
1494
|
+
#
|
1495
|
+
# This returns an array with the translations for <tt>:foo</tt> and <tt>:bar</tt>.
|
1496
|
+
# I18n.t [:foo, :bar]
|
1497
|
+
#
|
1498
|
+
# Can be used with dot-separated nested keys:
|
1499
|
+
# I18n.t [:'baz.foo', :'baz.bar']
|
1500
|
+
#
|
1501
|
+
# Which is the same as using a scope option:
|
1502
|
+
# I18n.t [:foo, :bar], :scope => :baz
|
1503
|
+
#
|
1504
|
+
# *LAMBDAS*
|
1505
|
+
#
|
1506
|
+
# Both translations and defaults can be given as Ruby lambdas. Lambdas will be
|
1507
|
+
# called and passed the key and options.
|
1508
|
+
#
|
1509
|
+
# E.g. assuming the key <tt>:salutation</tt> resolves to:
|
1510
|
+
# lambda { |key, options| options[:gender] == 'm' ? "Mr. #{options[:name]}" : "Mrs. #{options[:name]}" }
|
1511
|
+
#
|
1512
|
+
# Then <tt>I18n.t(:salutation, :gender => 'w', :name => 'Smith') will result in "Mrs. Smith".
|
1513
|
+
#
|
1514
|
+
# Note that the string returned by lambda will go through string interpolation too,
|
1515
|
+
# so the following lambda would give the same result:
|
1516
|
+
# lambda { |key, options| options[:gender] == 'm' ? "Mr. %{name}" : "Mrs. %{name}" }
|
1517
|
+
#
|
1518
|
+
# It is recommended to use/implement lambdas in an "idempotent" way. E.g. when
|
1519
|
+
# a cache layer is put in front of I18n.translate it will generate a cache key
|
1520
|
+
# from the argument values passed to #translate. Therefore your lambdas should
|
1521
|
+
# always return the same translations/values per unique combination of argument
|
1522
|
+
# values.
|
1523
|
+
#
|
1524
|
+
# *Ruby 2.7+ keyword arguments warning*
|
1525
|
+
#
|
1526
|
+
# This method uses keyword arguments.
|
1527
|
+
# There is a breaking change in ruby that produces warning with ruby 2.7 and won't work as expected with ruby 3.0
|
1528
|
+
# The "hash" parameter must be passed as keyword argument.
|
1529
|
+
#
|
1530
|
+
# Good:
|
1531
|
+
# I18n.t(:salutation, :gender => 'w', :name => 'Smith')
|
1532
|
+
# I18n.t(:salutation, **{ :gender => 'w', :name => 'Smith' })
|
1533
|
+
# I18n.t(:salutation, **any_hash)
|
1534
|
+
#
|
1535
|
+
# Bad:
|
1536
|
+
# I18n.t(:salutation, { :gender => 'w', :name => 'Smith' })
|
1537
|
+
# I18n.t(:salutation, any_hash)
|
1538
|
+
#
|
1539
|
+
# @raise [Disabled]
|
1540
|
+
#
|
1541
|
+
# source://i18n//lib/i18n.rb#210
|
1542
|
+
def translate(key = T.unsafe(nil), throw: T.unsafe(nil), raise: T.unsafe(nil), locale: T.unsafe(nil), **options); end
|
1543
|
+
|
1544
|
+
# Wrapper for <tt>translate</tt> that adds <tt>:raise => true</tt>. With
|
1545
|
+
# this option, if no translation is found, it will raise <tt>I18n::MissingTranslationData</tt>
|
1546
|
+
#
|
1547
|
+
# source://i18n//lib/i18n.rb#229
|
1548
|
+
def translate!(key, **options); end
|
1549
|
+
|
1550
|
+
# Transliterates UTF-8 characters to ASCII. By default this method will
|
1551
|
+
# transliterate only Latin strings to an ASCII approximation:
|
1552
|
+
#
|
1553
|
+
# I18n.transliterate("Ærøskøbing")
|
1554
|
+
# # => "AEroskobing"
|
1555
|
+
#
|
1556
|
+
# I18n.transliterate("日本語")
|
1557
|
+
# # => "???"
|
1558
|
+
#
|
1559
|
+
# It's also possible to add support for per-locale transliterations. I18n
|
1560
|
+
# expects transliteration rules to be stored at
|
1561
|
+
# <tt>i18n.transliterate.rule</tt>.
|
1562
|
+
#
|
1563
|
+
# Transliteration rules can either be a Hash or a Proc. Procs must accept a
|
1564
|
+
# single string argument. Hash rules inherit the default transliteration
|
1565
|
+
# rules, while Procs do not.
|
1566
|
+
#
|
1567
|
+
# *Examples*
|
1568
|
+
#
|
1569
|
+
# Setting a Hash in <locale>.yml:
|
1570
|
+
#
|
1571
|
+
# i18n:
|
1572
|
+
# transliterate:
|
1573
|
+
# rule:
|
1574
|
+
# ü: "ue"
|
1575
|
+
# ö: "oe"
|
1576
|
+
#
|
1577
|
+
# Setting a Hash using Ruby:
|
1578
|
+
#
|
1579
|
+
# store_translations(:de, i18n: {
|
1580
|
+
# transliterate: {
|
1581
|
+
# rule: {
|
1582
|
+
# 'ü' => 'ue',
|
1583
|
+
# 'ö' => 'oe'
|
1584
|
+
# }
|
1585
|
+
# }
|
1586
|
+
# })
|
1587
|
+
#
|
1588
|
+
# Setting a Proc:
|
1589
|
+
#
|
1590
|
+
# translit = lambda {|string| MyTransliterator.transliterate(string) }
|
1591
|
+
# store_translations(:xx, :i18n => {:transliterate => {:rule => translit})
|
1592
|
+
#
|
1593
|
+
# Transliterating strings:
|
1594
|
+
#
|
1595
|
+
# I18n.locale = :en
|
1596
|
+
# I18n.transliterate("Jürgen") # => "Jurgen"
|
1597
|
+
# I18n.locale = :de
|
1598
|
+
# I18n.transliterate("Jürgen") # => "Juergen"
|
1599
|
+
# I18n.transliterate("Jürgen", :locale => :en) # => "Jurgen"
|
1600
|
+
# I18n.transliterate("Jürgen", :locale => :de) # => "Juergen"
|
1601
|
+
#
|
1602
|
+
# source://i18n//lib/i18n.rb#293
|
1603
|
+
def transliterate(key, throw: T.unsafe(nil), raise: T.unsafe(nil), locale: T.unsafe(nil), replacement: T.unsafe(nil), **options); end
|
1604
|
+
|
1605
|
+
# Executes block with given I18n.locale set.
|
1606
|
+
#
|
1607
|
+
# source://i18n//lib/i18n.rb#315
|
1608
|
+
def with_locale(tmp_locale = T.unsafe(nil)); end
|
1609
|
+
|
1610
|
+
private
|
1611
|
+
|
1612
|
+
# Any exceptions thrown in translate will be sent to the @@exception_handler
|
1613
|
+
# which can be a Symbol, a Proc or any other Object unless they're forced to
|
1614
|
+
# be raised or thrown (MissingTranslation).
|
1615
|
+
#
|
1616
|
+
# If exception_handler is a Symbol then it will simply be sent to I18n as
|
1617
|
+
# a method call. A Proc will simply be called. In any other case the
|
1618
|
+
# method #call will be called on the exception_handler object.
|
1619
|
+
#
|
1620
|
+
# Examples:
|
1621
|
+
#
|
1622
|
+
# I18n.exception_handler = :custom_exception_handler # this is the default
|
1623
|
+
# I18n.custom_exception_handler(exception, locale, key, options) # will be called like this
|
1624
|
+
#
|
1625
|
+
# I18n.exception_handler = lambda { |*args| ... } # a lambda
|
1626
|
+
# I18n.exception_handler.call(exception, locale, key, options) # will be called like this
|
1627
|
+
#
|
1628
|
+
# I18n.exception_handler = I18nExceptionHandler.new # an object
|
1629
|
+
# I18n.exception_handler.call(exception, locale, key, options) # will be called like this
|
1630
|
+
#
|
1631
|
+
# source://i18n//lib/i18n.rb#391
|
1632
|
+
def handle_exception(handling, exception, locale, key, options); end
|
1633
|
+
|
1634
|
+
# source://i18n//lib/i18n.rb#409
|
1635
|
+
def normalize_key(key, separator); end
|
1636
|
+
|
1637
|
+
# source://i18n//lib/i18n.rb#361
|
1638
|
+
def translate_key(key, throw, raise, locale, backend, options); end
|
1639
|
+
end
|
1640
|
+
|
1641
|
+
# source://i18n//lib/i18n/config.rb#6
|
1642
|
+
class I18n::Config
|
1643
|
+
# Returns an array of locales for which translations are available.
|
1644
|
+
# Unless you explicitly set these through I18n.available_locales=
|
1645
|
+
# the call will be delegated to the backend.
|
1646
|
+
#
|
1647
|
+
# source://i18n//lib/i18n/config.rb#43
|
1648
|
+
def available_locales; end
|
1649
|
+
|
1650
|
+
# Sets the available locales.
|
1651
|
+
#
|
1652
|
+
# source://i18n//lib/i18n/config.rb#57
|
1653
|
+
def available_locales=(locales); end
|
1654
|
+
|
1655
|
+
# Returns true if the available_locales have been initialized
|
1656
|
+
#
|
1657
|
+
# @return [Boolean]
|
1658
|
+
#
|
1659
|
+
# source://i18n//lib/i18n/config.rb#64
|
1660
|
+
def available_locales_initialized?; end
|
1661
|
+
|
1662
|
+
# Caches the available locales list as both strings and symbols in a Set, so
|
1663
|
+
# that we can have faster lookups to do the available locales enforce check.
|
1664
|
+
#
|
1665
|
+
# source://i18n//lib/i18n/config.rb#50
|
1666
|
+
def available_locales_set; end
|
1667
|
+
|
1668
|
+
# Returns the current backend. Defaults to +Backend::Simple+.
|
1669
|
+
#
|
1670
|
+
# source://i18n//lib/i18n/config.rb#20
|
1671
|
+
def backend; end
|
1672
|
+
|
1673
|
+
# Sets the current backend. Used to set a custom backend.
|
1674
|
+
#
|
1675
|
+
# source://i18n//lib/i18n/config.rb#25
|
1676
|
+
def backend=(backend); end
|
1677
|
+
|
1678
|
+
# Clears the available locales set so it can be recomputed again after I18n
|
1679
|
+
# gets reloaded.
|
1680
|
+
#
|
1681
|
+
# source://i18n//lib/i18n/config.rb#70
|
1682
|
+
def clear_available_locales_set; end
|
1683
|
+
|
1684
|
+
# Returns the current default locale. Defaults to :'en'
|
1685
|
+
#
|
1686
|
+
# source://i18n//lib/i18n/config.rb#30
|
1687
|
+
def default_locale; end
|
1688
|
+
|
1689
|
+
# Sets the current default locale. Used to set a custom default locale.
|
1690
|
+
#
|
1691
|
+
# source://i18n//lib/i18n/config.rb#35
|
1692
|
+
def default_locale=(locale); end
|
1693
|
+
|
1694
|
+
# Returns the current default scope separator. Defaults to '.'
|
1695
|
+
#
|
1696
|
+
# source://i18n//lib/i18n/config.rb#75
|
1697
|
+
def default_separator; end
|
1698
|
+
|
1699
|
+
# Sets the current default scope separator.
|
1700
|
+
#
|
1701
|
+
# source://i18n//lib/i18n/config.rb#80
|
1702
|
+
def default_separator=(separator); end
|
1703
|
+
|
1704
|
+
# source://i18n//lib/i18n/config.rb#141
|
1705
|
+
def enforce_available_locales; end
|
1706
|
+
|
1707
|
+
# source://i18n//lib/i18n/config.rb#145
|
1708
|
+
def enforce_available_locales=(enforce_available_locales); end
|
1709
|
+
|
1710
|
+
# Returns the current exception handler. Defaults to an instance of
|
1711
|
+
# I18n::ExceptionHandler.
|
1712
|
+
#
|
1713
|
+
# source://i18n//lib/i18n/config.rb#86
|
1714
|
+
def exception_handler; end
|
1715
|
+
|
1716
|
+
# Sets the exception handler.
|
1717
|
+
#
|
1718
|
+
# source://i18n//lib/i18n/config.rb#91
|
1719
|
+
def exception_handler=(exception_handler); end
|
1720
|
+
|
1721
|
+
# Returns the current interpolation patterns. Defaults to
|
1722
|
+
# I18n::DEFAULT_INTERPOLATION_PATTERNS.
|
1723
|
+
#
|
1724
|
+
# source://i18n//lib/i18n/config.rb#151
|
1725
|
+
def interpolation_patterns; end
|
1726
|
+
|
1727
|
+
# Sets the current interpolation patterns. Used to set a interpolation
|
1728
|
+
# patterns.
|
1729
|
+
#
|
1730
|
+
# E.g. using {{}} as a placeholder like "{{hello}}, world!":
|
1731
|
+
#
|
1732
|
+
# I18n.config.interpolation_patterns << /\{\{(\w+)\}\}/
|
1733
|
+
#
|
1734
|
+
# source://i18n//lib/i18n/config.rb#161
|
1735
|
+
def interpolation_patterns=(interpolation_patterns); end
|
1736
|
+
|
1737
|
+
# Allow clients to register paths providing translation data sources. The
|
1738
|
+
# backend defines acceptable sources.
|
1739
|
+
#
|
1740
|
+
# E.g. the provided SimpleBackend accepts a list of paths to translation
|
1741
|
+
# files which are either named *.rb and contain plain Ruby Hashes or are
|
1742
|
+
# named *.yml and contain YAML data. So for the SimpleBackend clients may
|
1743
|
+
# register translation files like this:
|
1744
|
+
# I18n.load_path << 'path/to/locale/en.yml'
|
1745
|
+
#
|
1746
|
+
# source://i18n//lib/i18n/config.rb#126
|
1747
|
+
def load_path; end
|
1748
|
+
|
1749
|
+
# Sets the load path instance. Custom implementations are expected to
|
1750
|
+
# behave like a Ruby Array.
|
1751
|
+
#
|
1752
|
+
# source://i18n//lib/i18n/config.rb#132
|
1753
|
+
def load_path=(load_path); end
|
1754
|
+
|
1755
|
+
# The only configuration value that is not global and scoped to thread is :locale.
|
1756
|
+
# It defaults to the default_locale.
|
1757
|
+
#
|
1758
|
+
# source://i18n//lib/i18n/config.rb#9
|
1759
|
+
def locale; end
|
1760
|
+
|
1761
|
+
# Sets the current locale pseudo-globally, i.e. in the Thread.current hash.
|
1762
|
+
#
|
1763
|
+
# source://i18n//lib/i18n/config.rb#14
|
1764
|
+
def locale=(locale); end
|
1765
|
+
|
1766
|
+
# Returns the current handler for situations when interpolation argument
|
1767
|
+
# is missing. MissingInterpolationArgument will be raised by default.
|
1768
|
+
#
|
1769
|
+
# source://i18n//lib/i18n/config.rb#97
|
1770
|
+
def missing_interpolation_argument_handler; end
|
1771
|
+
|
1772
|
+
# Sets the missing interpolation argument handler. It can be any
|
1773
|
+
# object that responds to #call. The arguments that will be passed to #call
|
1774
|
+
# are the same as for MissingInterpolationArgument initializer. Use +Proc.new+
|
1775
|
+
# if you don't care about arity.
|
1776
|
+
#
|
1777
|
+
# == Example:
|
1778
|
+
# You can suppress raising an exception and return string instead:
|
1779
|
+
#
|
1780
|
+
# I18n.config.missing_interpolation_argument_handler = Proc.new do |key|
|
1781
|
+
# "#{key} is missing"
|
1782
|
+
# end
|
1783
|
+
#
|
1784
|
+
# source://i18n//lib/i18n/config.rb#114
|
1785
|
+
def missing_interpolation_argument_handler=(exception_handler); end
|
1786
|
+
end
|
1787
|
+
|
1788
|
+
# source://i18n//lib/i18n/interpolate/ruby.rb#5
|
1789
|
+
I18n::DEFAULT_INTERPOLATION_PATTERNS = T.let(T.unsafe(nil), Array)
|
1790
|
+
|
1791
|
+
# source://i18n//lib/i18n/exceptions.rb#18
|
1792
|
+
class I18n::Disabled < ::I18n::ArgumentError
|
1793
|
+
# @return [Disabled] a new instance of Disabled
|
1794
|
+
#
|
1795
|
+
# source://i18n//lib/i18n/exceptions.rb#19
|
1796
|
+
def initialize(method); end
|
1797
|
+
end
|
1798
|
+
|
1799
|
+
# source://i18n//lib/i18n.rb#35
|
1800
|
+
I18n::EMPTY_HASH = T.let(T.unsafe(nil), Hash)
|
1801
|
+
|
1802
|
+
# source://i18n//lib/i18n/exceptions.rb#6
|
1803
|
+
class I18n::ExceptionHandler
|
1804
|
+
# source://i18n//lib/i18n/exceptions.rb#7
|
1805
|
+
def call(exception, _locale, _key, _options); end
|
1806
|
+
end
|
1807
|
+
|
1808
|
+
# source://i18n//lib/i18n/gettext.rb#4
|
1809
|
+
module I18n::Gettext
|
1810
|
+
class << self
|
1811
|
+
# source://i18n//lib/i18n/gettext.rb#21
|
1812
|
+
def extract_scope(msgid, separator); end
|
1813
|
+
|
1814
|
+
# returns an array of plural keys for the given locale or the whole hash
|
1815
|
+
# of locale mappings to plural keys so that we can convert from gettext's
|
1816
|
+
# integer-index based style
|
1817
|
+
# TODO move this information to the pluralization module
|
1818
|
+
#
|
1819
|
+
# source://i18n//lib/i18n/gettext.rb#17
|
1820
|
+
def plural_keys(*args); end
|
1821
|
+
end
|
1822
|
+
end
|
1823
|
+
|
1824
|
+
# source://i18n//lib/i18n/gettext.rb#6
|
1825
|
+
I18n::Gettext::CONTEXT_SEPARATOR = T.let(T.unsafe(nil), String)
|
1826
|
+
|
1827
|
+
# Implements classical Gettext style accessors. To use this include the
|
1828
|
+
# module to the global namespace or wherever you want to use it.
|
1829
|
+
#
|
1830
|
+
# include I18n::Gettext::Helpers
|
1831
|
+
#
|
1832
|
+
# source://i18n//lib/i18n/gettext/helpers.rb#11
|
1833
|
+
module I18n::Gettext::Helpers
|
1834
|
+
# Makes dynamic translation messages readable for the gettext parser.
|
1835
|
+
# <tt>_(fruit)</tt> cannot be understood by the gettext parser. To help the parser find all your translations,
|
1836
|
+
# you can add <tt>fruit = N_("Apple")</tt> which does not translate, but tells the parser: "Apple" needs translation.
|
1837
|
+
# * msgid: the message id.
|
1838
|
+
# * Returns: msgid.
|
1839
|
+
#
|
1840
|
+
# source://i18n//lib/i18n/gettext/helpers.rb#17
|
1841
|
+
def N_(msgsid); end
|
1842
|
+
|
1843
|
+
# source://i18n//lib/i18n/gettext/helpers.rb#21
|
1844
|
+
def _(msgid, options = T.unsafe(nil)); end
|
1845
|
+
|
1846
|
+
# source://i18n//lib/i18n/gettext/helpers.rb#21
|
1847
|
+
def gettext(msgid, options = T.unsafe(nil)); end
|
1848
|
+
|
1849
|
+
# source://i18n//lib/i18n/gettext/helpers.rb#38
|
1850
|
+
def n_(msgid, msgid_plural, n = T.unsafe(nil)); end
|
1851
|
+
|
1852
|
+
# source://i18n//lib/i18n/gettext/helpers.rb#38
|
1853
|
+
def ngettext(msgid, msgid_plural, n = T.unsafe(nil)); end
|
1854
|
+
|
1855
|
+
# Method signatures:
|
1856
|
+
# npgettext('Fruits', 'apple', 'apples', 2)
|
1857
|
+
# npgettext('Fruits', ['apple', 'apples'], 2)
|
1858
|
+
#
|
1859
|
+
# source://i18n//lib/i18n/gettext/helpers.rb#61
|
1860
|
+
def np_(msgctxt, msgid, msgid_plural, n = T.unsafe(nil)); end
|
1861
|
+
|
1862
|
+
# Method signatures:
|
1863
|
+
# npgettext('Fruits', 'apple', 'apples', 2)
|
1864
|
+
# npgettext('Fruits', ['apple', 'apples'], 2)
|
1865
|
+
#
|
1866
|
+
# source://i18n//lib/i18n/gettext/helpers.rb#61
|
1867
|
+
def npgettext(msgctxt, msgid, msgid_plural, n = T.unsafe(nil)); end
|
1868
|
+
|
1869
|
+
# Method signatures:
|
1870
|
+
# nsgettext('Fruits|apple', 'apples', 2)
|
1871
|
+
# nsgettext(['Fruits|apple', 'apples'], 2)
|
1872
|
+
#
|
1873
|
+
# source://i18n//lib/i18n/gettext/helpers.rb#46
|
1874
|
+
def ns_(msgid, msgid_plural, n = T.unsafe(nil), separator = T.unsafe(nil)); end
|
1875
|
+
|
1876
|
+
# Method signatures:
|
1877
|
+
# nsgettext('Fruits|apple', 'apples', 2)
|
1878
|
+
# nsgettext(['Fruits|apple', 'apples'], 2)
|
1879
|
+
#
|
1880
|
+
# source://i18n//lib/i18n/gettext/helpers.rb#46
|
1881
|
+
def nsgettext(msgid, msgid_plural, n = T.unsafe(nil), separator = T.unsafe(nil)); end
|
1882
|
+
|
1883
|
+
# source://i18n//lib/i18n/gettext/helpers.rb#32
|
1884
|
+
def p_(msgctxt, msgid); end
|
1885
|
+
|
1886
|
+
# source://i18n//lib/i18n/gettext/helpers.rb#32
|
1887
|
+
def pgettext(msgctxt, msgid); end
|
1888
|
+
|
1889
|
+
# source://i18n//lib/i18n/gettext/helpers.rb#26
|
1890
|
+
def s_(msgid, separator = T.unsafe(nil)); end
|
1891
|
+
|
1892
|
+
# source://i18n//lib/i18n/gettext/helpers.rb#26
|
1893
|
+
def sgettext(msgid, separator = T.unsafe(nil)); end
|
1894
|
+
end
|
1895
|
+
|
1896
|
+
# source://i18n//lib/i18n/gettext.rb#5
|
1897
|
+
I18n::Gettext::PLURAL_SEPARATOR = T.let(T.unsafe(nil), String)
|
1898
|
+
|
1899
|
+
# source://i18n//lib/i18n/interpolate/ruby.rb#10
|
1900
|
+
I18n::INTERPOLATION_PATTERN = T.let(T.unsafe(nil), Regexp)
|
1901
|
+
|
1902
|
+
# source://i18n//lib/i18n/exceptions.rb#124
|
1903
|
+
class I18n::InvalidFilenames < ::I18n::ArgumentError
|
1904
|
+
# @return [InvalidFilenames] a new instance of InvalidFilenames
|
1905
|
+
#
|
1906
|
+
# source://i18n//lib/i18n/exceptions.rb#126
|
1907
|
+
def initialize(file_errors); end
|
1908
|
+
end
|
1909
|
+
|
1910
|
+
# source://i18n//lib/i18n/exceptions.rb#125
|
1911
|
+
I18n::InvalidFilenames::NUMBER_OF_ERRORS_SHOWN = T.let(T.unsafe(nil), Integer)
|
1912
|
+
|
1913
|
+
# source://i18n//lib/i18n/exceptions.rb#32
|
1914
|
+
class I18n::InvalidLocale < ::I18n::ArgumentError
|
1915
|
+
# @return [InvalidLocale] a new instance of InvalidLocale
|
1916
|
+
#
|
1917
|
+
# source://i18n//lib/i18n/exceptions.rb#34
|
1918
|
+
def initialize(locale); end
|
1919
|
+
|
1920
|
+
# Returns the value of attribute locale.
|
1921
|
+
#
|
1922
|
+
# source://i18n//lib/i18n/exceptions.rb#33
|
1923
|
+
def locale; end
|
1924
|
+
end
|
1925
|
+
|
1926
|
+
# source://i18n//lib/i18n/exceptions.rb#40
|
1927
|
+
class I18n::InvalidLocaleData < ::I18n::ArgumentError
|
1928
|
+
# @return [InvalidLocaleData] a new instance of InvalidLocaleData
|
1929
|
+
#
|
1930
|
+
# source://i18n//lib/i18n/exceptions.rb#42
|
1931
|
+
def initialize(filename, exception_message); end
|
1932
|
+
|
1933
|
+
# Returns the value of attribute filename.
|
1934
|
+
#
|
1935
|
+
# source://i18n//lib/i18n/exceptions.rb#41
|
1936
|
+
def filename; end
|
1937
|
+
end
|
1938
|
+
|
1939
|
+
# source://i18n//lib/i18n/exceptions.rb#82
|
1940
|
+
class I18n::InvalidPluralizationData < ::I18n::ArgumentError
|
1941
|
+
# @return [InvalidPluralizationData] a new instance of InvalidPluralizationData
|
1942
|
+
#
|
1943
|
+
# source://i18n//lib/i18n/exceptions.rb#84
|
1944
|
+
def initialize(entry, count, key); end
|
1945
|
+
|
1946
|
+
# Returns the value of attribute count.
|
1947
|
+
#
|
1948
|
+
# source://i18n//lib/i18n/exceptions.rb#83
|
1949
|
+
def count; end
|
1950
|
+
|
1951
|
+
# Returns the value of attribute entry.
|
1952
|
+
#
|
1953
|
+
# source://i18n//lib/i18n/exceptions.rb#83
|
1954
|
+
def entry; end
|
1955
|
+
|
1956
|
+
# Returns the value of attribute key.
|
1957
|
+
#
|
1958
|
+
# source://i18n//lib/i18n/exceptions.rb#83
|
1959
|
+
def key; end
|
1960
|
+
end
|
1961
|
+
|
1962
|
+
# source://i18n//lib/i18n/backend/key_value.rb#21
|
1963
|
+
I18n::JSON = ActiveSupport::JSON
|
1964
|
+
|
1965
|
+
# source://i18n//lib/i18n/locale.rb#4
|
1966
|
+
module I18n::Locale; end
|
1967
|
+
|
1968
|
+
# source://i18n//lib/i18n/locale/fallbacks.rb#48
|
1969
|
+
class I18n::Locale::Fallbacks < ::Hash
|
1970
|
+
# @return [Fallbacks] a new instance of Fallbacks
|
1971
|
+
#
|
1972
|
+
# source://i18n//lib/i18n/locale/fallbacks.rb#49
|
1973
|
+
def initialize(*mappings); end
|
1974
|
+
|
1975
|
+
# @raise [InvalidLocale]
|
1976
|
+
#
|
1977
|
+
# source://i18n//lib/i18n/locale/fallbacks.rb#60
|
1978
|
+
def [](locale); end
|
1979
|
+
|
1980
|
+
# Returns the value of attribute defaults.
|
1981
|
+
#
|
1982
|
+
# source://i18n//lib/i18n/locale/fallbacks.rb#58
|
1983
|
+
def defaults; end
|
1984
|
+
|
1985
|
+
# source://i18n//lib/i18n/locale/fallbacks.rb#55
|
1986
|
+
def defaults=(defaults); end
|
1987
|
+
|
1988
|
+
# source://i18n//lib/i18n/locale/fallbacks.rb#67
|
1989
|
+
def map(*args, &block); end
|
1990
|
+
|
1991
|
+
protected
|
1992
|
+
|
1993
|
+
# source://i18n//lib/i18n/locale/fallbacks.rb#84
|
1994
|
+
def compute(tags, include_defaults = T.unsafe(nil), exclude = T.unsafe(nil)); end
|
1995
|
+
end
|
1996
|
+
|
1997
|
+
# source://i18n//lib/i18n/locale/tag.rb#5
|
1998
|
+
module I18n::Locale::Tag
|
1999
|
+
class << self
|
2000
|
+
# Returns the current locale tag implementation. Defaults to +I18n::Locale::Tag::Simple+.
|
2001
|
+
#
|
2002
|
+
# source://i18n//lib/i18n/locale/tag.rb#12
|
2003
|
+
def implementation; end
|
2004
|
+
|
2005
|
+
# Sets the current locale tag implementation. Use this to set a different locale tag implementation.
|
2006
|
+
#
|
2007
|
+
# source://i18n//lib/i18n/locale/tag.rb#17
|
2008
|
+
def implementation=(implementation); end
|
2009
|
+
|
2010
|
+
# Factory method for locale tags. Delegates to the current locale tag implementation.
|
2011
|
+
#
|
2012
|
+
# source://i18n//lib/i18n/locale/tag.rb#22
|
2013
|
+
def tag(tag); end
|
2014
|
+
end
|
2015
|
+
end
|
2016
|
+
|
2017
|
+
# source://i18n//lib/i18n/locale/tag/parents.rb#4
|
2018
|
+
module I18n::Locale::Tag::Parents
|
2019
|
+
# source://i18n//lib/i18n/locale/tag/parents.rb#5
|
2020
|
+
def parent; end
|
2021
|
+
|
2022
|
+
# source://i18n//lib/i18n/locale/tag/parents.rb#18
|
2023
|
+
def parents; end
|
2024
|
+
|
2025
|
+
# source://i18n//lib/i18n/locale/tag/parents.rb#14
|
2026
|
+
def self_and_parents; end
|
2027
|
+
end
|
2028
|
+
|
2029
|
+
# source://i18n//lib/i18n/locale/tag/rfc4646.rb#12
|
2030
|
+
I18n::Locale::Tag::RFC4646_FORMATS = T.let(T.unsafe(nil), Hash)
|
2031
|
+
|
2032
|
+
# source://i18n//lib/i18n/locale/tag/rfc4646.rb#11
|
2033
|
+
I18n::Locale::Tag::RFC4646_SUBTAGS = T.let(T.unsafe(nil), Array)
|
2034
|
+
|
2035
|
+
# source://i18n//lib/i18n/locale/tag/rfc4646.rb#14
|
2036
|
+
class I18n::Locale::Tag::Rfc4646 < ::Struct
|
2037
|
+
include ::I18n::Locale::Tag::Parents
|
2038
|
+
|
2039
|
+
# source://i18n//lib/i18n/locale/tag/rfc4646.rb#35
|
2040
|
+
def language; end
|
2041
|
+
|
2042
|
+
# source://i18n//lib/i18n/locale/tag/rfc4646.rb#35
|
2043
|
+
def region; end
|
2044
|
+
|
2045
|
+
# source://i18n//lib/i18n/locale/tag/rfc4646.rb#35
|
2046
|
+
def script; end
|
2047
|
+
|
2048
|
+
# source://i18n//lib/i18n/locale/tag/rfc4646.rb#46
|
2049
|
+
def to_a; end
|
2050
|
+
|
2051
|
+
# source://i18n//lib/i18n/locale/tag/rfc4646.rb#42
|
2052
|
+
def to_s; end
|
2053
|
+
|
2054
|
+
# source://i18n//lib/i18n/locale/tag/rfc4646.rb#38
|
2055
|
+
def to_sym; end
|
2056
|
+
|
2057
|
+
# source://i18n//lib/i18n/locale/tag/rfc4646.rb#35
|
2058
|
+
def variant; end
|
2059
|
+
|
2060
|
+
class << self
|
2061
|
+
# source://i18n//lib/i18n/locale/tag/rfc4646.rb#23
|
2062
|
+
def parser; end
|
2063
|
+
|
2064
|
+
# source://i18n//lib/i18n/locale/tag/rfc4646.rb#27
|
2065
|
+
def parser=(parser); end
|
2066
|
+
|
2067
|
+
# Parses the given tag and returns a Tag instance if it is valid.
|
2068
|
+
# Returns false if the given tag is not valid according to RFC 4646.
|
2069
|
+
#
|
2070
|
+
# source://i18n//lib/i18n/locale/tag/rfc4646.rb#18
|
2071
|
+
def tag(tag); end
|
2072
|
+
end
|
2073
|
+
end
|
2074
|
+
|
2075
|
+
# source://i18n//lib/i18n/locale/tag/rfc4646.rb#50
|
2076
|
+
module I18n::Locale::Tag::Rfc4646::Parser
|
2077
|
+
class << self
|
2078
|
+
# source://i18n//lib/i18n/locale/tag/rfc4646.rb#63
|
2079
|
+
def match(tag); end
|
2080
|
+
end
|
2081
|
+
end
|
2082
|
+
|
2083
|
+
# source://i18n//lib/i18n/locale/tag/rfc4646.rb#51
|
2084
|
+
I18n::Locale::Tag::Rfc4646::Parser::PATTERN = T.let(T.unsafe(nil), Regexp)
|
2085
|
+
|
2086
|
+
# source://i18n//lib/i18n/locale/tag/simple.rb#6
|
2087
|
+
class I18n::Locale::Tag::Simple
|
2088
|
+
include ::I18n::Locale::Tag::Parents
|
2089
|
+
|
2090
|
+
# @return [Simple] a new instance of Simple
|
2091
|
+
#
|
2092
|
+
# source://i18n//lib/i18n/locale/tag/simple.rb#17
|
2093
|
+
def initialize(*tag); end
|
2094
|
+
|
2095
|
+
# source://i18n//lib/i18n/locale/tag/simple.rb#21
|
2096
|
+
def subtags; end
|
2097
|
+
|
2098
|
+
# Returns the value of attribute tag.
|
2099
|
+
#
|
2100
|
+
# source://i18n//lib/i18n/locale/tag/simple.rb#15
|
2101
|
+
def tag; end
|
2102
|
+
|
2103
|
+
# source://i18n//lib/i18n/locale/tag/simple.rb#33
|
2104
|
+
def to_a; end
|
2105
|
+
|
2106
|
+
# source://i18n//lib/i18n/locale/tag/simple.rb#29
|
2107
|
+
def to_s; end
|
2108
|
+
|
2109
|
+
# source://i18n//lib/i18n/locale/tag/simple.rb#25
|
2110
|
+
def to_sym; end
|
2111
|
+
|
2112
|
+
class << self
|
2113
|
+
# source://i18n//lib/i18n/locale/tag/simple.rb#8
|
2114
|
+
def tag(tag); end
|
2115
|
+
end
|
2116
|
+
end
|
2117
|
+
|
2118
|
+
# source://i18n//lib/i18n/middleware.rb#4
|
2119
|
+
class I18n::Middleware
|
2120
|
+
# @return [Middleware] a new instance of Middleware
|
2121
|
+
#
|
2122
|
+
# source://i18n//lib/i18n/middleware.rb#6
|
2123
|
+
def initialize(app); end
|
2124
|
+
|
2125
|
+
# source://i18n//lib/i18n/middleware.rb#10
|
2126
|
+
def call(env); end
|
2127
|
+
end
|
2128
|
+
|
2129
|
+
# source://i18n//lib/i18n/exceptions.rb#90
|
2130
|
+
class I18n::MissingInterpolationArgument < ::I18n::ArgumentError
|
2131
|
+
# @return [MissingInterpolationArgument] a new instance of MissingInterpolationArgument
|
2132
|
+
#
|
2133
|
+
# source://i18n//lib/i18n/exceptions.rb#92
|
2134
|
+
def initialize(key, values, string); end
|
2135
|
+
|
2136
|
+
# Returns the value of attribute key.
|
2137
|
+
#
|
2138
|
+
# source://i18n//lib/i18n/exceptions.rb#91
|
2139
|
+
def key; end
|
2140
|
+
|
2141
|
+
# Returns the value of attribute string.
|
2142
|
+
#
|
2143
|
+
# source://i18n//lib/i18n/exceptions.rb#91
|
2144
|
+
def string; end
|
2145
|
+
|
2146
|
+
# Returns the value of attribute values.
|
2147
|
+
#
|
2148
|
+
# source://i18n//lib/i18n/exceptions.rb#91
|
2149
|
+
def values; end
|
2150
|
+
end
|
2151
|
+
|
2152
|
+
# source://i18n//lib/i18n/exceptions.rb#48
|
2153
|
+
class I18n::MissingTranslation < ::I18n::ArgumentError
|
2154
|
+
include ::I18n::MissingTranslation::Base
|
2155
|
+
end
|
2156
|
+
|
2157
|
+
# source://i18n//lib/i18n/exceptions.rb#49
|
2158
|
+
module I18n::MissingTranslation::Base
|
2159
|
+
# source://i18n//lib/i18n/exceptions.rb#54
|
2160
|
+
def initialize(locale, key, options = T.unsafe(nil)); end
|
2161
|
+
|
2162
|
+
# Returns the value of attribute key.
|
2163
|
+
#
|
2164
|
+
# source://i18n//lib/i18n/exceptions.rb#52
|
2165
|
+
def key; end
|
2166
|
+
|
2167
|
+
# source://i18n//lib/i18n/exceptions.rb#59
|
2168
|
+
def keys; end
|
2169
|
+
|
2170
|
+
# Returns the value of attribute locale.
|
2171
|
+
#
|
2172
|
+
# source://i18n//lib/i18n/exceptions.rb#52
|
2173
|
+
def locale; end
|
2174
|
+
|
2175
|
+
# source://i18n//lib/i18n/exceptions.rb#65
|
2176
|
+
def message; end
|
2177
|
+
|
2178
|
+
# Returns the value of attribute options.
|
2179
|
+
#
|
2180
|
+
# source://i18n//lib/i18n/exceptions.rb#52
|
2181
|
+
def options; end
|
2182
|
+
|
2183
|
+
# source://i18n//lib/i18n/exceptions.rb#70
|
2184
|
+
def to_exception; end
|
2185
|
+
|
2186
|
+
# source://i18n//lib/i18n/exceptions.rb#65
|
2187
|
+
def to_s; end
|
2188
|
+
end
|
2189
|
+
|
2190
|
+
# source://i18n//lib/i18n/exceptions.rb#50
|
2191
|
+
I18n::MissingTranslation::Base::PERMITTED_KEYS = T.let(T.unsafe(nil), Array)
|
2192
|
+
|
2193
|
+
# source://i18n//lib/i18n/exceptions.rb#78
|
2194
|
+
class I18n::MissingTranslationData < ::I18n::ArgumentError
|
2195
|
+
include ::I18n::MissingTranslation::Base
|
2196
|
+
end
|
2197
|
+
|
2198
|
+
# source://i18n//lib/i18n.rb#19
|
2199
|
+
I18n::RESERVED_KEYS = T.let(T.unsafe(nil), Array)
|
2200
|
+
|
2201
|
+
# source://i18n//lib/i18n/exceptions.rb#98
|
2202
|
+
class I18n::ReservedInterpolationKey < ::I18n::ArgumentError
|
2203
|
+
# @return [ReservedInterpolationKey] a new instance of ReservedInterpolationKey
|
2204
|
+
#
|
2205
|
+
# source://i18n//lib/i18n/exceptions.rb#100
|
2206
|
+
def initialize(key, string); end
|
2207
|
+
|
2208
|
+
# Returns the value of attribute key.
|
2209
|
+
#
|
2210
|
+
# source://i18n//lib/i18n/exceptions.rb#99
|
2211
|
+
def key; end
|
2212
|
+
|
2213
|
+
# Returns the value of attribute string.
|
2214
|
+
#
|
2215
|
+
# source://i18n//lib/i18n/exceptions.rb#99
|
2216
|
+
def string; end
|
2217
|
+
end
|
2218
|
+
|
2219
|
+
# source://i18n//lib/i18n/tests.rb#4
|
2220
|
+
module I18n::Tests; end
|
2221
|
+
|
2222
|
+
# source://i18n//lib/i18n/tests/localization.rb#3
|
2223
|
+
module I18n::Tests::Localization
|
2224
|
+
class << self
|
2225
|
+
# @private
|
2226
|
+
#
|
2227
|
+
# source://i18n//lib/i18n/tests/localization.rb#9
|
2228
|
+
def included(base); end
|
2229
|
+
end
|
2230
|
+
end
|
2231
|
+
|
2232
|
+
# source://i18n//lib/i18n/exceptions.rb#106
|
2233
|
+
class I18n::UnknownFileType < ::I18n::ArgumentError
|
2234
|
+
# @return [UnknownFileType] a new instance of UnknownFileType
|
2235
|
+
#
|
2236
|
+
# source://i18n//lib/i18n/exceptions.rb#108
|
2237
|
+
def initialize(type, filename); end
|
2238
|
+
|
2239
|
+
# Returns the value of attribute filename.
|
2240
|
+
#
|
2241
|
+
# source://i18n//lib/i18n/exceptions.rb#107
|
2242
|
+
def filename; end
|
2243
|
+
|
2244
|
+
# Returns the value of attribute type.
|
2245
|
+
#
|
2246
|
+
# source://i18n//lib/i18n/exceptions.rb#107
|
2247
|
+
def type; end
|
2248
|
+
end
|
2249
|
+
|
2250
|
+
# source://i18n//lib/i18n/exceptions.rb#114
|
2251
|
+
class I18n::UnsupportedMethod < ::I18n::ArgumentError
|
2252
|
+
# @return [UnsupportedMethod] a new instance of UnsupportedMethod
|
2253
|
+
#
|
2254
|
+
# source://i18n//lib/i18n/exceptions.rb#116
|
2255
|
+
def initialize(method, backend_klass, msg); end
|
2256
|
+
|
2257
|
+
# Returns the value of attribute backend_klass.
|
2258
|
+
#
|
2259
|
+
# source://i18n//lib/i18n/exceptions.rb#115
|
2260
|
+
def backend_klass; end
|
2261
|
+
|
2262
|
+
# Returns the value of attribute method.
|
2263
|
+
#
|
2264
|
+
# source://i18n//lib/i18n/exceptions.rb#115
|
2265
|
+
def method; end
|
2266
|
+
|
2267
|
+
# Returns the value of attribute msg.
|
2268
|
+
#
|
2269
|
+
# source://i18n//lib/i18n/exceptions.rb#115
|
2270
|
+
def msg; end
|
2271
|
+
end
|
2272
|
+
|
2273
|
+
# source://i18n//lib/i18n/utils.rb#4
|
2274
|
+
module I18n::Utils
|
2275
|
+
class << self
|
2276
|
+
# source://i18n//lib/i18n/utils.rb#18
|
2277
|
+
def deep_merge(hash, other_hash, &block); end
|
2278
|
+
|
2279
|
+
# source://i18n//lib/i18n/utils.rb#22
|
2280
|
+
def deep_merge!(hash, other_hash, &block); end
|
2281
|
+
|
2282
|
+
# source://i18n//lib/i18n/utils.rb#34
|
2283
|
+
def deep_symbolize_keys(hash); end
|
2284
|
+
|
2285
|
+
# source://i18n//lib/i18n/utils.rb#7
|
2286
|
+
def except(hash, *keys); end
|
2287
|
+
|
2288
|
+
private
|
2289
|
+
|
2290
|
+
# source://i18n//lib/i18n/utils.rb#43
|
2291
|
+
def deep_symbolize_keys_in_object(value); end
|
2292
|
+
end
|
2293
|
+
end
|
2294
|
+
|
2295
|
+
# source://i18n//lib/i18n/version.rb#4
|
2296
|
+
I18n::VERSION = T.let(T.unsafe(nil), String)
|