AppImageLauncher
AppImageLauncher copied to clipboard
Simplified Chinese translation not work
Describe the bug Though some (now all) strings has been translated into Simplified Chinese, all strings all displayed in English.
Expected behavior Translated strings should be displayed.
To Reproduce Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Screenshots If applicable, add screenshots to help explain your problem.
System, software and AppImage information Your distribution and desktop environment (including version numbers): Ubuntu 20.04/19.10/19.04
AppImageLauncher version installed: 2.1.3 from release page. Other versions never worked for me either.
List of AppImages you tried:
- [...]
The translations are updated only occasionally, and releases aren't made too often. I'll pull them in now and will rebuild the binaries. The continuous release builds should then work.
Builds are on the way, you can track the progress here.
Thanks! Though the build succeeded, I can't find bionic amd64 deb on github release...
I test 984, it still displays Engilsh only.
Please post the values of the environment variables LC_ALL and LANGUAGE.
$ echo $LC_ALL
$ echo $LANGUAGE
zh_CN:zh:en_US:en
So, your locale is zh_CN, but the translation files use zh_Hans. I presume that mismatch causes the issue. Mind to run env LANGUAGE=zh_Hans AppImageLauncherSettings? If that works, we found the root cause.
Still English only...
Until today I still got English of application language only. I'm wonder how do you get system language .Maybe we can try fix it
I still can't get Chinese.Please help
After struggling with the code. I found on my arch install the result of const auto systemLocale = QLocale::system().name(); should be zh_CN. So the translation file should be named as ui.zh_CN.qm.
And I don't know how to debug a particular file. I just wanna debug the translation manager and I'm gonna find out what had gone wrong. and dev plz help me.
QLocale::system() just reads $LC_ALL and $LANGUAGE and picks a suitable value. There is no easy way to have it fall back to an available locale. We'd have to parse both environment variables ourselves, but that's too much effort.
Simplified Chinese would be zh_Hans, not zh_CN. See https://stackoverflow.com/a/4894634. We could copy the translations from zh_Hans to zh_CN. Then, you can check, update and fix the translations on Weblate.
~~By the way, please try running env LANG=zh_Hans LANGUAGE=zh_Hans LC_ALL=zh_Hans AppImageLauncher <some AppImage> in a terminal. You should see the translation then.~~
This doesn't seem to work. I'll have to investigate that...
Okay I will try it. And I'm wondering how you get system language. In my case the locale is zh_CN.UTF-8.
Did you git clone the repository? If yes, please go into the clone, then do the following steps:
cd i18n
# create a mainland chinese translation
cp ui.zh_Hans.ts ui.zh_CN.ts
cd ..
mkdir build
cd build
# build binaries
cmake ..
make
# test the new locale
src/ui/AppImageLauncher <some AppImage>
Okay. I don't know the QT and Cpp at all . So I said I'm struggling with the code. Now I got the file name . Trying to figure out how it works. However I need some sleep now . It's 4 am in China. And I will reply you as soon as I try it
It doesn't work. Still English.I looked through the source code of translatemanager it seems that the program uses a relative path to load the translation file.So I just wanna debug the translate manager so that I can figure it out what is going on inside the program
I used qDebug trying to get it's translation dir. And I found the directory seems to be right. Now I'm trying to get what the translation file should be. I looked through the translatemanager.h and translatemanager.cpp. It will only return the translate dir. Could you tell me how to get the the full path of the translation file supposed to be loaded. Thank you !
Now I figured out what the filename the translation file should be in Chinese. The filename should be ui.zh_CN.qm. Now I will try rename the file and recompile it. Do I need to modify the MakeFile? I'm confused about it.
P.S. Here is the code.
I added a new function in translationmanager.cpp.
QString TranslationManager::getTranslationFile(){ const auto translationDirPrefix = getTranslationDir(); const auto systemLocale = QLocale::system().name(); const auto translationFileDir = translationDirPrefix + "/ui." + systemLocale + ".qm"; return translationFileDir; }
Don't Forget to add
static QString getTranslationFile(); in under the public in the header file.
I also added some debug outpout as soon as the program runs.
settings_main.cpp
include qDebug first
` dialog.show();
qDebug() << QLocale::system().name(); //get your current locale eg zh_CN
qDebug() << QLocale::system().nativeCountryName(); //get your country name eg 中国
qDebug() << QLocale::system().nativeLanguageName(); // get your language e.g 简体中文
qDebug() << "豆豆起豆起豆强" << TranslationManager::getTranslationFile();` show me the translation filename and its path.
I rename the ts file and recompile the program . When I built it. I found in the language files directory contains both ui.zh_CN.qm and ui.zh_Hans.qm. I think the filename might not be the root cause. BTW are you sue it will display non English character ? Especially the Appimage settings
Once you copied the ts file, you have to run make l10n in order to build the qm file which the translation manager loads.
However I renamed recompiled . It doesn't work . I did some modifications to translation manger and and use qtranslator manually. I will start a new pull request later