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