AppImageLauncher icon indicating copy to clipboard operation
AppImageLauncher copied to clipboard

Simplified Chinese translation not work

Open linsui opened this issue 5 years ago • 22 comments

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:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. 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:

  • [...]

linsui avatar May 20 '20 11:05 linsui

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.

TheAssassin avatar May 26 '20 18:05 TheAssassin

Builds are on the way, you can track the progress here.

TheAssassin avatar May 26 '20 18:05 TheAssassin

Thanks! Though the build succeeded, I can't find bionic amd64 deb on github release...

linsui avatar May 28 '20 15:05 linsui

I test 984, it still displays Engilsh only.

linsui avatar Jun 12 '20 16:06 linsui

Please post the values of the environment variables LC_ALL and LANGUAGE.

TheAssassin avatar Jun 12 '20 16:06 TheAssassin

$ echo $LC_ALL

$ echo $LANGUAGE
zh_CN:zh:en_US:en

linsui avatar Jun 13 '20 01:06 linsui

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.

TheAssassin avatar Jun 13 '20 01:06 TheAssassin

Still English only...

linsui avatar Jun 13 '20 02:06 linsui

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

linlinger avatar Mar 19 '21 15:03 linlinger

I still can't get Chinese.Please help

linlinger avatar Apr 26 '21 17:04 linlinger

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.

linlinger avatar Apr 28 '21 18:04 linlinger

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.

TheAssassin avatar Apr 28 '21 19:04 TheAssassin

~~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...

TheAssassin avatar Apr 28 '21 19:04 TheAssassin

Okay I will try it. And I'm wondering how you get system language. In my case the locale is zh_CN.UTF-8.

linlinger avatar Apr 28 '21 19:04 linlinger

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>

TheAssassin avatar Apr 28 '21 20:04 TheAssassin

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

linlinger avatar Apr 28 '21 20:04 linlinger

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

linlinger avatar Apr 28 '21 20:04 linlinger

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 !

linlinger avatar Apr 29 '21 14:04 linlinger

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.

linlinger avatar Apr 29 '21 17:04 linlinger

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

linlinger avatar Apr 29 '21 17:04 linlinger

Once you copied the ts file, you have to run make l10n in order to build the qm file which the translation manager loads.

TheAssassin avatar May 02 '21 20:05 TheAssassin

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

linlinger avatar May 03 '21 07:05 linlinger