lxqt / lxqt-policykit

The LXQt PolicyKit agent
https://lxqt.github.io
GNU Lesser General Public License v2.1
31 stars 20 forks source link

the word "password" is displayed in English even though it has been translated #146

Closed knm100 closed 1 month ago

knm100 commented 1 month ago
Expected Behavior

Show the word password that have been translated

Current Behavior

the word password display in english under the locale zh_CN swappy-20241012-215636 the ts file show the password have been translated swappy-20241012-215555

Possible Solution

fixed the ts file

Steps to Reproduce (for bugs)
  1. change your locale to zh_CN
  2. run the lxqt-polickit-agent
  3. you will see the issue as the screensave
Context
System Information
palinek commented 1 month ago

The user input prompt is set to whatever the the polkit agent receives (libpolkit-gobject). E.g. see the debug:

$ POLKIT_DEBUG=1 LANG=zh_CN.UTF-8 LANGUAGE=zh_CN:zh lxqt-policykit-agent
New PolkitAgentListener  0x55a1fb70d880
Adding new listener  PolkitQt1::Agent::Listener(0x7fff731cf4b0) for  0x55a1fb70d880
Listener adapter polkit_qt_listener_initiate_authentication
GSimpleAsyncResult: 0x55a1fb731300
polkit_qt_listener_initiate_authentication callback for  0x55a1fb70d880
PolkitAgentSession: initiating authentication for identity `unix-user:***', cookie 17-9d2a068993e0df6ac1d189d9444c1435-1-0f31a56f4d3499b278e21b81f8a73f88
PolkitAgentSession: spawned helper with pid 13162
PolkitAgentSession: read `PAM_PROMPT_ECHO_OFF Password: ' from helper
PolkitAgentSession: emitting ::request('Password: ', FALSE)
REQUEST
PolkitAgentSession: canceling authentication
PolkitAgentSession: emitting ::completed(FALSE)
COMPLETED
Listener adapter polkit_qt_listener_initiate_authentication_finish
polkit_qt_listener_initiate_authentication_finish callback for  0x55a1fb70d880

So we don't have any control over the translation here. You need to get sure, that the prompt is sent localized to see it localized in the GUI.

knm100 commented 1 month ago

This must be a software issue, because surely the software was not designed to have everything else translated and just leave the password untranslated. If this were true, the TS file would not even list the password's translation Any way, thank you for developing this software for free!

tsujan commented 1 month ago

Actually, this is a duplicate of https://github.com/lxqt/lxqt-policykit/issues/127.

If this were true, the TS file would not even list the password's translation

As I said at https://github.com/lxqt/lxqt-policykit/issues/127, our localized text will be used only if nothing replaces it. And as @palinek explained, the localization state of what replaces it is out of our control.

tsujan commented 1 month ago

That being said, a simple workaround is possible, such that, if the replacing text is identical to Password: (in a case-insensitive way), our localized version of Password: will be kept.

I don't know how many cases will be "corrected" in this way.

knm100 commented 1 month ago

I set the locale to zh_TW.UTF-8, which is a locale without TS files, but still some are translated and some aren't. it is probably not an issue with this program, but with qt itself.
Thank you both for your answers. @tsujan @palinek

tsujan commented 1 month ago

Adding a workaround is justified because this happens with any app that calls pkexec in its code. Reopening...

tsujan commented 1 month ago

@knm100 It's "fixed" in git now and will be in LXQt 2.1.0. Thanks for the report!

knm100 commented 1 month ago

@tsujan thank your very much!