Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hovering "Size: X x Y" translated to non-Primary language on macOS #263

Open
apjanke opened this issue Mar 13, 2019 · 5 comments
Open

Hovering "Size: X x Y" translated to non-Primary language on macOS #263

apjanke opened this issue Mar 13, 2019 · 5 comments
Labels
platform:macOS macOS-specific issues

Comments

@apjanke
Copy link
Contributor

apjanke commented Mar 13, 2019

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.

Screen Shot 2019-03-12 at 9 05 24 PM

qterminal-resize-with-french

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:

  1. In System Preferences > Language & Region, add another Preferred language, but do not make it your Primary language.
  2. Run qterminal, or example from QTermWidget
  3. Make sure "Show terminal size on resize" is enabled in Preferences > Appearance
  4. 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)
@apjanke apjanke changed the title Hovering "Size: X x Y" translated when it shouldn't be Hovering "Size: X x Y" translated to non-Primary language on macOS Mar 13, 2019
@apjanke
Copy link
Contributor Author

apjanke commented Mar 13, 2019

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?

@apjanke
Copy link
Contributor Author

apjanke commented Mar 13, 2019

Related references:

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?

@yan12125 yan12125 added the platform:macOS macOS-specific issues label Apr 11, 2019
@yan12125
Copy link
Member

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.

@agaida
Copy link
Member

agaida commented Aug 27, 2019

@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 :)

@agaida
Copy link
Member

agaida commented Aug 27, 2019

meh - a link should be enough if there is no native en_EN file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:macOS macOS-specific issues
Projects
None yet
Development

No branches or pull requests

3 participants