@@ -170,48 +170,6 @@ have such implementations.
170170` set_arg ` calls are handled transparently by diagnostic derives but need to be
171171added manually when using diagnostic builder APIs.
172172
173- ### Loading
174-
175- rustc makes a distinction between the "fallback bundle" for ` en-US ` that is used
176- by default and when another locale is missing a message; and the primary fluent
177- bundle which is requested by the user.
178-
179- Diagnostic emitters implement the ` Emitter ` trait which has two functions for
180- accessing the fallback and primary fluent bundles (` fallback_fluent_bundle ` and
181- ` fluent_bundle ` respectively).
182-
183- ` Emitter ` also has member functions with default implementations for performing
184- translation of a ` DiagMessage ` using the results of
185- ` fallback_fluent_bundle ` and ` fluent_bundle ` .
186-
187- All of the emitters in rustc load the fallback Fluent bundle lazily, only
188- reading Fluent resources and parsing them when an error message is first being
189- translated (for performance reasons - it doesn't make sense to do this if no
190- error is being emitted). ` rustc_error_messages::fallback_fluent_bundle ` returns
191- a ` std::lazy::Lazy<FluentBundle> ` which is provided to emitters and evaluated
192- in the first call to ` Emitter::fallback_fluent_bundle ` .
193-
194- The primary Fluent bundle (for the user's desired locale) is expected to be
195- returned by ` Emitter::fluent_bundle ` . This bundle is used preferentially when
196- translating messages, the fallback bundle is only used if the primary bundle is
197- missing a message or not provided.
198-
199- There are no locale bundles distributed with the compiler,
200- but mechanisms are implemented for loading them.
201-
202- - ` -Ztranslate-additional-ftl ` can be used to load a specific resource as the
203- primary bundle for testing purposes.
204- - ` -Ztranslate-lang ` can be provided a language identifier (something like
205- ` en-US ` ) and will load any Fluent resources found in
206- ` $sysroot/share/locale/$locale/ ` directory (both the user provided
207- sysroot and any sysroot candidates).
208-
209- Primary bundles are not currently loaded lazily and if requested will be loaded
210- at the start of compilation regardless of whether an error occurs. Lazily
211- loading primary bundles is possible if it can be assumed that loading a bundle
212- won't fail. Bundle loading can fail if a requested locale is missing, Fluent
213- files are malformed, or a message is duplicated in multiple resources.
214-
215173[ Fluent ] : https://projectfluent.org
216174[ `compiler/rustc_borrowck/messages.ftl` ] : https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc_borrowck/messages.ftl
217175[ `compiler/rustc_parse/messages.ftl` ] : https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc_parse/messages.ftl
0 commit comments