Closed salvadorbs closed 3 years ago
Oh Dear, thats nasty. And I should have expected it too. (Terrible monculture here in Australia, we assume everybody speaks English!) I note the word 'ENABLED' does not seem to have been translated, is that because 'ENABLED' is acceptable Italian ? I will do some experimenting, what if the OS is set to a non Roman character set ....
Otherwise, I am not sure how to get around this, if I use a term I put in the .po files, it will depend on the person doing my translating returning exactly the same text and the initial (gnome-extensions) translation. And thats most certainly not going to work.
I suppose I can determine what are correct responses for just the languages I currently support but that will mean people using other languages will get a misleading response.
Thanks for spotting this, I should have seen it coming !
Davi
I think the answer may be to use the exit code of gnome-extensions enable xxx
It will enable the plugin if its not enabled and returns false if its not available. Its not as safe as looking for State: ENABLED in that it does not pickup a problem with the extension so we will need to 'assume' its working OK. I hate 'assume' ....
I will be unable to do this today, too busy but will try and code something up tomorrow. It will be simpler but a touch less safe.
Davo
No, actually, very easy, I have pushed up some code that may work as expected. Very, very untested.
Davo
Oh Dear, thats nasty. And I should have expected it too.
Honestly, it was a coincidence. I'm used to Windows, where all CLI tools have an output in English (even if the Windows display language is Italian).
On Gnome, however, output language is Italian (if there is a translation) and it also bothers me.
I note the word 'ENABLED' does not seem to have been translated, is that because 'ENABLED' is acceptable Italian ?
Er... no, it is not acceptable. I believe it is a hardcode keyword. See https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/master/subprojects/extensions-tool/src/main.c#L30
I think the answer may be to use the exit code of gnome-extensions enable xxx
In my opinion, it is better to rely on the ENABLED keyword (using Info command) than to use the Enable command.
Let's think of a case where the user downloaded the SysTray extension, but decided to leave it disabled (for any reasons). Using the Enable command, we make an unintentional change to its environment.
Hmm, I agree that making a change to the user's system is a something that should be avoided, I am considering it because -
Concentrating on the second point, thats the big one. I have tried to run eg
LANG=es_ES.UTF-8 gnome-extensions info xxx [enter]
But it still comes out in English. My tomboy-ng switches to Spanish and I expected gnome-extensions to as well. Obviously, I need do more than that. Don't know what.
I have tried to look up the source code, but its buried in the gnome shell project, totally beyond me.
Davo
Oh, am I having a bad day !
Sorry salvadorbs, I just noticed that you posted a link to the gnome-extensions code that I could not find ! Well done and thanks. And, as you note, looks like "ENABLED" really is hardwired. Thats a very strange thing to do ....
I think I will do it that way after all. But not tonight, its already too late !
Davo
Sorry salvadorbs, I just noticed that you posted a link to the gnome-extensions code that I could not find ! Well done and thanks.
No problem 😄
And, as you note, looks like "ENABLED" really is hardwired. Thats a very strange thing to do ....
Yeah, it is quite strange and questionable strategy (why hard code !?). Either way, we can use it to our advantage!
I think I will do it that way after all. But not tonight, its already too late !
Eheh. For today, I don't bother you anymore! 😃
OK, yet another approach. And perhaps, a good one ?
The list command to gnome-extensions will take a switch, --enabled, to tell it just to list enabled plugins. Its not translated in any way so safe to use. And has the added benefit that we can use it to list all installed plugins so its possible to identify when the user has installed but not enabled.
Could even then ask user if they want it enabled (but I have not yet coded that up, think I will, easier than describing the manual way to do it).
Its checked in now, superficially tested on Debian and Fedora. Works, no memory leaks.
I would value your opinion.
Davo
I can confirm that it also works on Ubuntu 20.10. Good work! 😄
P.S.: Sorry for late
OK, we'll call this done. I've used this approach in tomboy-ng, hope salvadorbs got something from it too.
Hi dbannon,
I was looking at the two methods CheckForSysTray and CheckGnomeExtras to insert them into my project and I noticed that the gnome-extensions command returns translated text in the language used by the system.
Since in my environment test, I have Italian as primary language, the command returns the field names in Italian:
Nome: ..... Descrizione: ... Percorso: ... URL: ... Stato: ENABLED
So the CheckGnomeExt function will always be false on my system ("Stato: ENABLED" vs "State: ENABLED"):
https://github.com/tomboy-notes/tomboy-ng/blob/427925013f6d234440806ebc80a718bd2d50ef85/source/mainunit.pas#L422