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
).
about locale1, please refer to https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.locale1.html
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.