Default locale in options dialog is broken #5023

Closed
opened 2026-02-21 17:37:41 -05:00 by deekerman · 2 comments
Owner

Originally created by @zeule on GitHub (Dec 20, 2016).

When I start qBt with a fresh profile and open the options dialogue, qBt finds that locale is unset and tries to select the default one (English). And it fails, at least on my system. The problem is the following: qBt thinks that default locale is "en" and looks for one defined by QLocale("en").name(). But there is no locale named "en"! QLocale("en").name() return "en_US" (correct locale name), yet there is no such locale in the qBt localisation list. Instead there is "en". AFAICT, "en" translation file has to be renamed into "en_US", and the call in OptionsDialog::setLocale() shall use "en_US" as the fallback.

Originally created by @zeule on GitHub (Dec 20, 2016). When I start qBt with a fresh profile and open the options dialogue, qBt finds that locale is unset and tries to select the default one (English). And it fails, at least on my system. The problem is the following: qBt thinks that default locale is "en" and looks for one defined by `QLocale("en").name()`. But there is no locale named "en"! `QLocale("en").name()` return "en_US" (correct locale name), yet there is no such locale in the qBt localisation list. Instead there is "en". AFAICT, "en" translation file has to be renamed into "en_US", and the call in `OptionsDialog::setLocale()` shall use "en_US" as the fallback.
Author
Owner

@sledgehammer999 commented on GitHub (Dec 22, 2016):

The supposed sequence(from my memory) is:

  1. If nothing is explicitly set, then try to use the same locale as the user's machine if we have a translation for it.
  2. Otherwise, fallback to "en" which is -in effect- the original text. I don't think we distribute/package an qbittorrent_en.ts. So since it can't find a .ts it should use the untranslated strings.

So what do you mean it "fails on my system"? What language do you get?

@sledgehammer999 commented on GitHub (Dec 22, 2016): The supposed sequence(from my memory) is: 1. If nothing is **explicitly** set, then try to use the same locale as the user's machine if we have a translation for it. 2. Otherwise, fallback to "en" which is -in effect- the original text. I don't think we distribute/package an qbittorrent_en.ts. So since it can't find a .ts it should use the untranslated strings. So what do you mean it "fails on my system"? What language do you get?
Author
Owner

@zeule commented on GitHub (Dec 22, 2016):

I get an assert in line 1317 of optionsflg.cpp (and no language selected if asserts are disabled).

Otherwise, fallback to "en" which is -in effect- the original text.

That's is the problem. There is no locale with name "en", and Qt transforms the name to "en_US", but the translation file is named "en" and as such there is no entry "en_US" in m_ui->comboI18n.

@zeule commented on GitHub (Dec 22, 2016): I get an assert in line 1317 of optionsflg.cpp (and no language selected if asserts are disabled). > Otherwise, fallback to "en" which is -in effect- the original text. That's is the problem. There is no locale with name "en", and Qt transforms the name to "en_US", but the translation file is named "en" and as such there is no entry "en_US" in `m_ui->comboI18n`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/qBittorrent#5023
No description provided.