xxxserxxx / gotop

A terminal based graphical activity monitor inspired by gtop and vtop
Other
2.76k stars 140 forks source link

Add a translation file of Mandarin Chinese #136

Closed Tigerfyj closed 4 years ago

xxxserxxx commented 4 years ago

@Tigerfyj It may take a bit for this to show up as I haven't yet finished or merged the translation code. Thank you for the contribution, though! There's no top-to-bottom nor right-to-left support in termui -- will these translations make any sense for end users if they're horizontal left-to-right?

Tigerfyj commented 4 years ago

No problem. I understand it's a lot of effort to release a new feature. Chinese text is horizontal left-to-right in almost all cases. Only a few ancient books are still printed as top-to-bottom, e.g. the buddhist scriptures. That won't be our case.

Thanks & Best Regards Tiger Feng

xxxserxxx notifications@github.com 于2020年6月16日周二 下午6:38写道:

@Tigerfyj https://github.com/Tigerfyj It may take a bit for this to show up as I haven't yet finished or merged the translation code. Thank you for the contribution, though! There's no top-to-bottom nor right-to-left support in termui -- will these translations make any sense for end users if they're horizontal left-to-right?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xxxserxxx/gotop/pull/136#issuecomment-644683230, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4GAMRHZHM57OQCNY7B3O3RW5DTFANCNFSM4N5PTBKA .

xxxserxxx commented 4 years ago

@Tigerfyj , there's a branch called i18n, which contains the code for the translations. It is fairly complete in terms of the list of translation strings. If you're able to, would you pull and build that branch and test the translations in the UI? And if you are able to fill in the other translations, that'd be a huge help!

LANG=zh_CN go run ./cmd/gotop

works for me, and I can see the Chinese, but I'm not able to verify that it's correct.

I am considering removing the errors from translation, as it will make debugging more difficult for me when users report errors; therefore, you can leave the errors untranslated.

Thanks for your help with the Mandarin!

Tigerfyj commented 4 years ago

Tried, the program remains showing English. I also double checked the git branch is de187a8....

I have tried the following commands: LANG=zh_CN go run ./cmd/gotop LANG=zh_CN.UTF-8 go run ./cmd/gotop

The suffix ".UTF-8" is required on Debian. As comparison, the "LANG=zh_CN man ls" reported an error; "LANG=zh_CN.UTF-8 man ls" shows the help content in Chinese. Does the suffix cause the issue to the go program?

Thanks & Best Regards Tiger Feng

xxxserxxx notifications@github.com 于2020年6月19日周五 上午9:03写道:

@Tigerfyj https://github.com/Tigerfyj , there's a branch called i18n, which contains the code for the translations. It is fairly complete in terms of the list of translation strings. If you're able to, would you pull and build that branch and test the translations in the UI? And if you are able to fill in the other translations, that'd be a huge help!

LANG=zh_CN go run ./cmd/gotop

works for me, and I can see the Chinese, but I'm not able to verify that it's correct.

I am considering removing the errors from translation, as it will make debugging more difficult for me when users report errors; therefore, you can leave the errors untranslated.

Thanks for your help with the Mandarin!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xxxserxxx/gotop/pull/136#issuecomment-646379000, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4GAMVCTFXR5WH2QJTR3M3RXK2ORANCNFSM4N5PTBKA .

xxxserxxx commented 4 years ago

Hm. I don't know about the suffix; I'll have to check that. I wouldn't be surprised if that's an issue. However, the translation that you did didn't have the widget labels in it yet, so if you check the zh_CN file, you'll see a lot of English. However, if you run LANG=zh_CN go run ./cmd/gotop -h you should see Mandarin, since what was in the toml and what you did translate was the help text. Let me know if you still see only English, and in the meantime I'll check on the suffix question. Thanks!

Tigerfyj commented 4 years ago

Oh, I got your point now. Yes, the program can show Chinese to me now. The suffix doesn't matter. I send another pull request to update the translation. Also found two things: 1) I got a blank page when I pressed '?' to show the help. 2) The key 'conffig' in the toml file looks like a typo. (double f)

Thanks & Best Regards Tiger Feng

xxxserxxx notifications@github.com 于2020年6月20日周六 上午12:35写道:

Hm. I don't know about the suffix; I'll have to check that. I wouldn't be surprised if that's an issue. However, the translation that you did didn't have the widget labels in it yet, so if you check the zh_CN file, you'll see a lot of English. However, if you run LANG=zh_CN go run ./cmd/gotop -h you should see Mandarin, since what was in the toml and what you did translate was the help text. Let me know if you still see only English, and in the meantime I'll check on the suffix question. Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xxxserxxx/gotop/pull/136#issuecomment-646734051, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4GAMXUAPY276QXH23WKPLRXOHUNANCNFSM4N5PTBKA .

Tigerfyj commented 4 years ago

3) "gotop --list keys" just shows "widget.help". Is it a same issue with 2)?

Thanks & Best Regards Tiger Feng

Tigerf tigerf@gmail.com 于2020年6月20日周六 下午1:33写道:

Oh, I got your point now. Yes, the program can show Chinese to me now. The suffix doesn't matter. I send another pull request to update the translation. Also found two things: 1) I got a blank page when I pressed '?' to show the help. 2) The key 'conffig' in the toml file looks like a typo. (double f)

Thanks & Best Regards Tiger Feng

xxxserxxx notifications@github.com 于2020年6月20日周六 上午12:35写道:

Hm. I don't know about the suffix; I'll have to check that. I wouldn't be surprised if that's an issue. However, the translation that you did didn't have the widget labels in it yet, so if you check the zh_CN file, you'll see a lot of English. However, if you run LANG=zh_CN go run ./cmd/gotop -h you should see Mandarin, since what was in the toml and what you did translate was the help text. Let me know if you still see only English, and in the meantime I'll check on the suffix question. Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xxxserxxx/gotop/pull/136#issuecomment-646734051, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4GAMXUAPY276QXH23WKPLRXOHUNANCNFSM4N5PTBKA .

xxxserxxx commented 4 years ago

I saw that issue with the help text; it was caused by the refactoring for the translation, and I'll track it down before I release -- I think it affects English as well.

Can you point to the line that contains the misspelling? Thanks.

xxxserxxx commented 4 years ago

@Tigerfyj Help text issue is resolved in branch i18n. I also moved some more hard-coded strings from code to the translation file. Sorry about the constantly changing contents. I'm adding more of the hard-coded strings as translations as we speak -- most are error messages.

Tigerfyj commented 4 years ago

The typo is at line 88 in 'en_US.toml' file.

Thanks & Best Regards Tiger Feng

xxxserxxx notifications@github.com 于2020年6月20日周六 下午10:51写道:

@Tigerfyj https://github.com/Tigerfyj Help text issue is resolved in branch i18n. I also moved some more hard-coded strings from code to the translation file. Sorry about the constantly changing contents. I'm adding more of the hard-coded strings as translations as we speak -- most are error messages.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xxxserxxx/gotop/pull/136#issuecomment-647005429, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4GAMTZYKTXDKUPU6QUY7DRXTEIPANCNFSM4N5PTBKA .

Tigerfyj commented 4 years ago

I just saw the 'list' & 'write' of [args] were changed back to English. Is it intended? I feel they are not the error messages.

Thanks & Best Regards Tiger Feng

Tigerf tigerf@gmail.com 于2020年6月21日周日 上午11:04写道:

The typo is at line 88 in 'en_US.toml' file.

Thanks & Best Regards Tiger Feng

xxxserxxx notifications@github.com 于2020年6月20日周六 下午10:51写道:

@Tigerfyj https://github.com/Tigerfyj Help text issue is resolved in branch i18n. I also moved some more hard-coded strings from code to the translation file. Sorry about the constantly changing contents. I'm adding more of the hard-coded strings as translations as we speak -- most are error messages.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xxxserxxx/gotop/pull/136#issuecomment-647005429, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4GAMTZYKTXDKUPU6QUY7DRXTEIPANCNFSM4N5PTBKA .

Tigerfyj commented 4 years ago

Two issues on my macos with the version 23364aa: 1) The title of the help page shows "-" between the text. Screenshot is attached. 2) If the "LANG" is empty, the program exists with the following message:

failed to get language setting from environment: Could not detect Language exit status 2

Thanks & Best Regards Tiger Feng

Tigerf tigerf@gmail.com 于2020年6月21日周日 上午11:21写道:

I just saw the 'list' & 'write' of [args] were changed back to English. Is it intended? I feel they are not the error messages.

Thanks & Best Regards Tiger Feng

Tigerf tigerf@gmail.com 于2020年6月21日周日 上午11:04写道:

The typo is at line 88 in 'en_US.toml' file.

Thanks & Best Regards Tiger Feng

xxxserxxx notifications@github.com 于2020年6月20日周六 下午10:51写道:

@Tigerfyj https://github.com/Tigerfyj Help text issue is resolved in branch i18n. I also moved some more hard-coded strings from code to the translation file. Sorry about the constantly changing contents. I'm adding more of the hard-coded strings as translations as we speak -- most are error messages.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xxxserxxx/gotop/pull/136#issuecomment-647005429, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4GAMTZYKTXDKUPU6QUY7DRXTEIPANCNFSM4N5PTBKA .

xxxserxxx commented 4 years ago

The typo is at line 88 in 'en_US.toml' file.

That's correct. conffile = conf file

I just saw the 'list' & 'write' of [args] were changed back to English

That was a merge error when I was copying new tags around. Thanks for catching that!

Some error messages are for users, as they may reflect user errors, such as bad command line arguments, or syntax errors in the config file or in a layout. I'm now leaning toward translating the error messages and including an error number on each so that if someone gives me an error.log I can easily find out which error it is.

2) If the "LANG" is empty, the program exists with the following message:

Hm. That's an issue with the underlying localization library, cloudfoundry-attic/jibber_jabber. I'll see what I can do about that.

xxxserxxx commented 4 years ago

@Tigerfyj , list and write were accidentally reverted; I've corrected this. Thanks for noticing the issue when the locale is missing; it's been addressed and pushed.

The hyphen (-) is not a literal hyphen; it's a result of how gizak/termui is drawing non-ASCII glyphs -- the dash is actually the box border showing through. I notice that on my laptop, all of the Chinese character glyphs are spaced out a bit. Is this usual, or are they usually more tightly drawn together? For example, when I dump out the rendered screen, I get a space between each glyph -- literally:

切 换 进 程 组 

However, no spaces exist in the translation file. This will require a bit more digging.

Edit 1

Note to self: it's not the lingo library; it's termui. C.f. gizak/termui#10

Tigerfyj commented 4 years ago

It's wired. Normally, a Chinese character's screen width is twice that of an ascii character. But, I have never seen a case which adds the extra whitespaces.

I have a blind guess: the library measures the character's length in UTF8 encoding. The result is 3 for each of the Chinese characters. Then, it draws the characters and leaves the extra space as the box border.

Thanks & Best Regards Tiger Feng

xxxserxxx notifications@github.com 于2020年6月21日周日 下午11:22写道:

@Tigerfyj https://github.com/Tigerfyj , list and write were accidentally reverted; I've corrected this. Thanks for noticing the issue when the locale is missing; it's been addressed and pushed.

The hyphen (-) is not a literal hyphen; it's a result of how gizak/termui is drawing non-ASCII glyphs -- the dash is actually the box border showing through. I notice that on my laptop, all of the Chinese character glyphs are spaced out a bit. Is this usual, or are they usually more tightly drawn together? For example, when I dump out the rendered screen, I get a space between each glyph -- literally:

切 换 进 程 组

However, no spaces exist in the translation file. This will require a bit more digging.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xxxserxxx/gotop/pull/136#issuecomment-647142046, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4GAMR3ZZGITHZ25DZVGFLRXYQUBANCNFSM4N5PTBKA .