Skip to content

Commit 55b0b19

Browse files
committed
feat(panel): get localized applet entries
Closes #1223
1 parent bd8dbbf commit 55b0b19

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

cosmic-settings/src/pages/applications/startup_apps.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl Page {
227227
directories.get(0).expect("Always at least one directory");
228228

229229
_ = std::fs::create_dir_all(directory_to_target.as_path());
230-
230+
231231
if let Ok(exists) = std::fs::exists(directory_to_target.join(file_name.clone())) {
232232
if !exists {
233233
// when adding an application, we want to symlink to be more user-friendly

cosmic-settings/src/pages/desktop/panel/applets_inner.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,15 +562,16 @@ impl<'a> TryFrom<Cow<'a, Path>> for Applet<'static> {
562562

563563
fn try_from(path: Cow<'a, Path>) -> Result<Self, Self::Error> {
564564
let content = std::fs::read_to_string(path.as_ref())?;
565-
let entry = DesktopEntry::from_str(path.as_ref(), &content, None::<&[&str]>)?;
565+
let languages = freedesktop_desktop_entry::get_languages_from_env();
566+
let entry = DesktopEntry::from_str(path.as_ref(), &content, Some(&languages))?;
566567
if entry.desktop_entry("X-CosmicApplet").is_none() {
567568
anyhow::bail!("Not an applet");
568569
}
569570

570571
Ok(Self {
571572
id: Cow::from(entry.id().to_string()),
572-
name: Cow::from(entry.name::<&str>(&[]).unwrap_or_default().to_string()),
573-
description: Cow::from(entry.comment::<&str>(&[]).unwrap_or_default().to_string()),
573+
name: Cow::from(entry.name(&languages).unwrap_or_default().to_string()),
574+
description: Cow::from(entry.comment(&languages).unwrap_or_default().to_string()),
574575
icon: Cow::from(entry.icon().unwrap_or_default().to_string()),
575576
path: Cow::from(path.into_owned()),
576577
})

0 commit comments

Comments
 (0)