Skip to content

Commit 40a9168

Browse files
wash2mmstick
authored andcommitted
fix: use LANG from env
1 parent e7bb8cc commit 40a9168

File tree

3 files changed

+4
-185
lines changed

3 files changed

+4
-185
lines changed

Cargo.lock

Lines changed: 0 additions & 168 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ i18n-embed = { version = "0.15.3", features = [
3232
i18n-embed-fl = "0.9.3"
3333
rust-embed = "8.5.0"
3434
glob = "0.3.2"
35-
langtag = "0.4"
3635
freedesktop-desktop-entry = "0.7.8"
3736
shlex = "1.3.0"
3837
serde = { version = "1.0.217", features = ["derive"] }

src/app.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ use cosmic::{
7171
use cosmic_app_list_config::AppListConfig;
7272
use freedesktop_desktop_entry::PathSource;
7373
use itertools::Itertools;
74-
use langtag::{LangTag, LangTagBuf};
7574
use log::error;
7675
use once_cell::sync::Lazy;
7776
use serde::{Deserialize, Serialize};
@@ -214,7 +213,7 @@ struct CosmicAppLibrary {
214213
config: AppLibraryConfig,
215214
cur_group: usize,
216215
active_surface: bool,
217-
locale: Option<LangTagBuf>,
216+
locale: Option<String>,
218217
edit_name: Option<String>,
219218
new_group: Option<String>,
220219
dnd_icon: Option<usize>,
@@ -349,18 +348,8 @@ pub fn menu_control_padding() -> Padding {
349348
impl CosmicAppLibrary {
350349
pub fn load_apps(&mut self) {
351350
let xdg_current_desktop = std::env::var("XDG_CURRENT_DESKTOP").ok();
352-
let locale = self.locale.as_ref().and_then(|l| {
353-
let Some(primary) = l.language().map(|l| l.primary()) else {
354-
return None;
355-
};
356-
Some(if let Some(region) = l.region() {
357-
format!("{}_{}", primary.as_str(), region.as_str())
358-
} else {
359-
primary.as_str().into()
360-
})
361-
});
362351
self.all_entries =
363-
cosmic::desktop::load_applications_filtered(locale.as_deref(), |entry| {
352+
cosmic::desktop::load_applications_filtered(self.locale.as_deref(), |entry| {
364353
entry.exec().is_some()
365354
&& !entry.no_display()
366355
&& xdg_current_desktop
@@ -1451,10 +1440,9 @@ impl cosmic::Application for CosmicAppLibrary {
14511440
config.groups.sort();
14521441

14531442
let self_ = Self {
1454-
// TODO proper conversion is
1455-
locale: current_locale::current_locale()
1443+
locale: std::env::var("LANG")
14561444
.ok()
1457-
.and_then(|l| LangTagBuf::new(l).ok()),
1445+
.and_then(|l| l.split(".").next().map(str::to_string)),
14581446
config,
14591447
core,
14601448
helper,

0 commit comments

Comments
 (0)