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