agateau / nanonote

A minimalist note taking application
Other
57 stars 11 forks source link

Add empty English translation file #26

Closed dlaidig closed 1 year ago

dlaidig commented 1 year ago

Previously, when QLocale().uiLanguages() returns English as the first language and another supported language as the second choice, the translation for the second language was loaded while Qt used English, leading to a mixed translation.

Screenshot 2023-01-21 at 14 16 03

See also https://codereview.qt-project.org/c/qt/qttranslations/+/353083

In this case, they used CMake code to generate the dummy English translation file. To keep it simple, I just manually created this file.

I tested the dmg built via GitHub actions to confirm that my changes really fix this issue.

agateau commented 1 year ago

Looks good, thanks! Going to look at why the Windows builder is failing before I can merge your work.

dlaidig commented 1 year ago

Unfortunately, I noticed that my fix has a very annoying side effect. Running make lupdate will cause the dummy English .ts file to be replaced with an actual translation file, and one has to manually revert the changes all the time.

I see two potential ways to fix this: Either adjust the CMakeLists.txt in a way that excludes the English file from lupdate or do something like in the Qt issue that I linked and generate the file during build (I'm assuming that also happens in the build directory, but I didn't look into it more).

I don't have too much experience with CMake, so it might be a lot easier for you to fix properly, but if you suggest the general direction, I can also try to provide a pull request for this.

agateau commented 1 year ago

It's actually a good thing to have an English translation: my template to build Qt apps defines an English translation, the reasons are documented here: https://github.com/agateau/cookiecutter-qt-app/blob/7678e47854a6d2a0d5ea268afd4a55af0f19b76e/docs/translations.md#why-is-there-an-english-translation.

Going to look into this.