mu-editor / mu

A small, simple editor for beginner Python programmers. Written in Python and Qt5.
http://codewith.mu
GNU General Public License v3.0
1.4k stars 434 forks source link

Help-button links to initally localised language instead of chosen #2400

Open Tengas opened 1 year ago

Tengas commented 1 year ago

What were you trying to do?

Access the "Help"-button

What steps did you take to trigger the issue?

I changed the language of Mu-editor to English which is my system language (relevant SO), restarted the app, clicked the "Help" button on the Tool.

What did you expect to happen?

I expected the "Help" button to direct me to a help page matching my chosen language

What actually happened?

The button opened the URL "https://codewith.mu/sv/help/1.2" which is the Swedish help url.

Operating System Version

Windows 10

Mu Version

1.2.0

Other Info

From what I gather the problem is that the variable i18n.language_code is never updated after it's intilialised to QLocale.system().name(). I think this could be fixed with adding the one-line:

self.language_code = language_code

after 24§i18n.py in the method i18n.set_language(language_code, localedir=localedir)

This follows from my tracking the method calls of the button:

  1. Clicking the "Help" button is detected in Editor.change_mode 1577§logic.py which calls Editor.show_help().
  2. Editor.show_help() which opens the URL obtains the address (at 1380§logic.py) with i18n.language_code[:2].
  3. i18n.language_code is initialized to QLocale.system().name().

This process should have an intersection with the logic that changes the program language. Updating the system language is performed by calling i18n.set_language in the method Editor.restore_session in 955§logic.py which is passed setting.session["locale"]. However, this method does not update the variable i18n.language_code.

Editor Log

No response