We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 873a7c7 commit 40c36f6Copy full SHA for 40c36f6
1 file changed
src/uucore/build.rs
@@ -274,14 +274,12 @@ fn embed_static_utility_locales(
274
/// It always includes "en-US" to ensure that a fallback is available if the
275
/// system locale's translation file is missing or if `LANG` is not set.
276
fn get_locales_to_embed(env: Option<String>) -> (String, Option<String>) {
277
- let system_locale = env.and_then(|lang| {
278
- let locale = lang.split('.').next()?.replace('_', "-");
279
- if locale != "en-US" && !locale.is_empty() {
280
- Some(locale)
281
- } else {
282
- None
283
- }
284
- });
+ let system_locale = env
+ .as_deref()
+ .and_then(|s| s.split('.').next())
+ .map(|s| s.replace('_', "-"))
+ .filter(|s| !s.is_empty() && s != "en-US");
+
285
("en-US".to_string(), system_locale)
286
}
287
0 commit comments