From 242daf86d9bbc062e0c32357453da26ddf955e13 Mon Sep 17 00:00:00 2001 From: mejrs <59372212+mejrs@users.noreply.github.com> Date: Tue, 14 Feb 2023 21:26:17 +0100 Subject: [PATCH] Handle selecting the default locale better --- compiler/rustc_error_messages/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_error_messages/src/lib.rs b/compiler/rustc_error_messages/src/lib.rs index 40ed10e7165..010e5f060bf 100644 --- a/compiler/rustc_error_messages/src/lib.rs +++ b/compiler/rustc_error_messages/src/lib.rs @@ -135,7 +135,10 @@ pub fn fluent_bundle( let fallback_locale = langid!("en-US"); let requested_fallback_locale = requested_locale.as_ref() == Some(&fallback_locale); - + trace!(?requested_fallback_locale); + if requested_fallback_locale && additional_ftl_path.is_none() { + return Ok(None); + } // If there is only `-Z additional-ftl-path`, assume locale is "en-US", otherwise use user // provided locale. let locale = requested_locale.clone().unwrap_or(fallback_locale); @@ -153,7 +156,7 @@ pub fn fluent_bundle( bundle.set_use_isolating(with_directionality_markers); // If the user requests the default locale then don't try to load anything. - if !requested_fallback_locale && let Some(requested_locale) = requested_locale { + if let Some(requested_locale) = requested_locale { let mut found_resources = false; for sysroot in user_provided_sysroot.iter_mut().chain(sysroot_candidates.iter_mut()) { sysroot.push("share");