Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions crates/edit/src/sys/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ where
pub fn preferred_languages(arena: &Arena) -> BVec<'_, &'_ str> {
let mut locales = BVec::empty();

for key in ["LANGUAGE", "LC_ALL", "LANG"] {
for key in ["LANGUAGE", "LC_ALL", "LC_MESSAGES", "LANG"] {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually don't see how this does anything about LANGUAGES being empty :D

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay okay this one is a drive-by. Technically we need to respect LC_MESSAGES for UI localization.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No i mean. To be fair. I don't see how "bail out when locales is populated" later is a fix for LANGUAGES being empty either. If LANGUAGES is empty, it's still going to go around the loop more times.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine w/ the drive-by fixes in general

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh duh, when I wrote "empty" I was talking about the filter() chain in the iterator. The issue is when it contains BS like LANGUAGE=":". In fact it may even be worth a thought to not break at all. Another thing I was thinking about is filtering out locales like "C", but they already fall back to en-US since that doesn't match anything.

In any case, this PR is the most trivial of all of them haha.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOL, I get it. Yeah it's funny that I'm hung up on the simplest one

if let Ok(val) = std::env::var(key)
&& !val.is_empty()
{
Expand All @@ -574,7 +574,9 @@ pub fn preferred_languages(arena: &Arena) -> BVec<'_, &'_ str> {
}

locales.extend_sloppy(arena, val.split(':').filter(|s| !s.is_empty()));
break;
if !locales.is_empty() {
break;
}
}
}

Expand Down
Loading