qtermwidget
qtermwidget copied to clipboard
Hovering "Size: X x Y" translated to non-Primary language on macOS
Here's a weird one. I have an English Mac. When I have French installed as one of my preferred languages, but not the Primary one, the hovering "Size:" display when resizing the terminal widget is translated to French.
This affects both QTerminal and the example
program included with QTermWidget.

Expected Behavior
Translation for all UI elements, including this hovering "Size:" display, are translated based on my Primary language.
Current Behavior
Existence of a second preferred language affects translation of the hovering "Size:" display on term widget resize, even when Primary language is not changed.
Removing ~/.config/qterminal.org
does not affect it.
Steps to Reproduce (for bugs)
On macOS:
- In System Preferences > Language & Region, add another Preferred language, but do not make it your Primary language.
- Run
qterminal
, orexample
from QTermWidget - Make sure "Show terminal size on resize" is enabled in Preferences > Appearance
- Resize the terminal window
System Information
- Distribution & Version: macOS 10.14.3
- Kernel: Darwin Kernel Version 18.2.0
- Qt Version: 5.12.1
- liblxqt Version: ???
- Package version: head of
master
(commit 9ee754a)
I bet this is because my primary language is English (en
), but there's no qtermwidget_en.qm
file in share/qtermwidget5/translations
in the installation, so Qt's QTranslator falls back to looking for my other preferred languages, and it finds one for fr
.
To test this, I removed share/qtermwidget5/translations
from my QTermWidget installation and re-ran example
. Sure enough, it's now saying "Size: X x Y". Then I did cp qtermwidget_zh_CN.qm qtermwidget_en.qm
and re-ran example
. Then the "Size:" display was in Chinese.
The doco for QTranslator::load(Qlocale locale, ...) says it uses QLocale::uiLanguages
for its search, and not just the locale name. And that's what my uiLanguages()
list is.
$ ./example master
QLocale::system(): QLocale(English, Latin, United States)
QLocale::system().uiLanguages(): ("en-US", "fr-US")
Maybe a qtermwidget_en.qm
needs to be added, that just translates each string to itself? Or has no translations defined at all? Or maybe the translator-loading code could be special-cased to check whether the UI primary languages is English, and since it knows the UI strings are already in English, not load any translators in that case?
Related references:
- https://forum.qt.io/topic/62723/qt-widgets-show-german-default-labels-on-uk-windows-system
- https://forum.qt.io/topic/71000/how-to-clear-qtranslator/3
The last one says to just use lupdate
and lrelease
to create a no-changes English translation file. I'm not familiar enough with Qt to know how to do that. Can I just create a basically-empty lib/translations/qtermwidget_en.ts
file? Or just copy the base qtermwidget.ts
to qtermwidget_en.ts
?
I guess some LC_\*
environment variables are not correctly set. Before working on this, I'd like to fix QTerminal.app bundle creation first. I'd like to support only one startup method - from launchd - to simplify initialization of environment variables.
@apjanke - i would copy it to *en_EN.ts - just give it a try. And yes, you are not alone, at least i heard that some people working on en_EN :)
meh - a link should be enough if there is no native en_EN file