lunchmoney 0.10.0

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