LBCrion / sfwbar

S* Floating Window Bar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can display the comment in desktop file to start menu according to the user's locale1

knm100 opened this issue · comments

Almost all desktops already have localized comments, which is useful to localize the menu.

Just a suggestion, not urgent, if it has an impact on your schedule, feel free to ignore it

I added a getlocale() expression function, which returns LC_ALL form of the current locale. You can select a localized string based on the current locale like this:

Set LocalString = Map(Extract(getlocale(), "(.*)_"),
    "en", "hello",
    "es", "hola",
    "default message for unhandled locale");

layout {
  ...
  label "mylabel" {
    value = $LocalString
  }
}

I set the function as deterministic for now, so that it doesn't cause constant string re-evaluation. You will need to manually trigger an update if the locale is changed (i.e. using SetValue "mylabel", $LocalString).

LC_ALL ? it usually is set to empty. LANG might be a better option
swappy-20240513-152928

swappy-20240513-212716
swappy-20240513-213108
The same config+widget, the first picture is a display of the latest 4dffd40 rev, the second picture is a display of the 6b1f740 rev. It seems that all the CSS in $HOME/.config/sfwbar/ doesn't work anymore!

I expect this is a byproduct of #175. Let's discuss this in more detail there.

Right, I was thinking locale rather than locale1 (I'm still not used to all this newfangled systemd stuff). I suspect the best way to introduce this would be to implement basic dbus property monitoring in the scanner, but this would likely need to wait for the next version.

No problem, That's not an urgent thing.