Page 1 of 1

turn off space wrap on chinese

Posted: Thu Feb 25, 2021 8:33 am
by 473BFF6D
TL;DR: space wrap not suitable for chinese.

Chinese normally [do not have spaces] and [wrapped char by char]. Current space wrap cleaves the sentence causing bad display when there are format spaces like the one between chinese and numbers and latin letters, between text and reference.

The following image shows a sentence cutted on " T ".
Image
An ideal display will be like this (without space wrap):
Image
(Chinese text: 按 T 打开科技面板开始新科技的研发。
Correspond english text in game: Press T to start a new research.
Direct translation: Press T to open science technology panel to start new science technologies' research and development.)

As I know, japanese have no spaces as well.

Re: turn off space wrap on chinese

Posted: Thu Feb 25, 2021 6:02 pm
by eradicator
+1
473BFF6D wrote:
Thu Feb 25, 2021 8:33 am
As I know, japanese have no spaces as well.
Correct. Though at least your example works fine:
ttoresearch.png
ttoresearch.png (4.53 KiB) Viewed 4790 times
Looking at core.cfg i think this might be considered a translation bug? The chinese translation actually has two spaces while the japanese one has none. Though i have to admit that a single half-width letter looks ugly when pressed against full-width japanese text without space. And the lack of space(ing) in the japense locale is probably just a hackfix for exactly this even more ugly wrapping issue.

Code: Select all

not-researching=按 __CONTROL__open-technology-gui__ 打开科技面板开始新科技的研发。

Code: Select all

not-researching=__CONTROL__open-technology-gui__を押して、新しい研究を開始しましょう!

Re: turn off space wrap on chinese

Posted: Thu Feb 25, 2021 6:32 pm
by eradicator
On further thought + testing this can be solved by using non-breaking space in the chinese core.cfg:

Code: Select all

not-researching=按 __CONTROL__open-technology-gui__ 打开科技面板开始新科技的研发。

Re: turn off space wrap on chinese

Posted: Thu Feb 25, 2021 6:35 pm
by eradicator
On further thought + testing this can be solved by using non-breaking space in the chinese core.cfg:

Code: Select all

not-researching=按 __CONTROL__open-technology-gui__ 打开科技面板开始新科技的研发。
Edit 1: Hrng! Looks like the forum softeware replaces non-breaking spaces with normal ones so i can't actually post that correctly.

Edit 2: I made a quick demo mod
er-chinese-non-break-demo_0.0.1.zip
(1.23 KiB) Downloaded 99 times

Edit 3: @moderation This thus may or may not have to be moved to the translation forum?

Re: turn off space wrap on chinese

Posted: Fri Feb 26, 2021 3:59 am
by 473BFF6D
Yes, NBSP, the most semantic correct solution. Hard to apply myself though.
I will go to translation forum to request a QA, just leave this post here.

Hopefully, a specify line breaking rule could be applied in game, not default english wrap-on-space and explicit NBSP.

Re: turn off space wrap on chinese

Posted: Fri Feb 26, 2021 6:25 am
by eradicator
473BFF6D wrote:
Fri Feb 26, 2021 3:59 am
Yes, NBSP, the most semantic correct solution. Hard to apply myself though.
I will go to translation forum to request a QA, just leave this post here.
As far as i understand everybody can contribute on the crowdin translation project. Not sure how the proof readers react to "invisible" changes. But the people in the translation forum will know more.
473BFF6D wrote:
Fri Feb 26, 2021 3:59 am
Hopefully, a specify line breaking rule could be applied in game, not default english wrap-on-space and explicit NBSP.
Yea, fixing the default wouldn't hurt i guess.

Re: turn off space wrap on chinese

Posted: Fri Feb 26, 2021 9:05 am
by wjy
Traditional Chinese (zh-tw) also suffers from this issue. The tech button is fine because of the short text, but the issue still occurs on another instance.
The tech button in zh-tw
The tech button in zh-tw
Screenshot_20210226_162610.png (9.2 KiB) Viewed 4679 times
Graphics settings in zh-tw
Graphics settings in zh-tw
Screenshot_20210226_163011.png (127.33 KiB) Viewed 4679 times
There are at least two ways to solve the issue. The first is to let Factorio developers implement line breaking rules according to a valid standard, and the second way is using special characters like NBSP to manually control the line breakings. I considered that the second way is a workaround because it's not perfect.

The zh-tw community members had discussed about whether to put spaces between Chinese and Latin texts. There are no clear conclusions because of the text displaying limits.

I am afraid that Factorio developers are not going to implement the rules because of the complexity.

I have notified the Simplified Chinese proofreader of this post. And thanks @473BFF6D for triggering a notification to me. I had subscribed the translation forum only.

Edit: Removed the link to Line Breaking Rules because it seems not directly related to this topic.

Re: turn off space wrap on chinese

Posted: Fri Feb 26, 2021 12:13 pm
by 473BFF6D
I just tried no space, SP, NBSP, ZWSP, ENSP, ZWJ, "", “”, they all cause wrap !?

Re: turn off space wrap on chinese

Posted: Fri Feb 26, 2021 12:22 pm
by 473BFF6D
I have heard factorio is written wth Allegro whose source code shows line breaks only appear on SP and tab which do not respect almost any of the Unicode Annex #14 who indicates line breaking algorithm including ones of ideographics and punctuations. But my test result above just confused me.

Re: turn off space wrap on chinese

Posted: Fri Feb 26, 2021 4:17 pm
by wjy
473BFF6D wrote:
Fri Feb 26, 2021 12:13 pm
I just tried no space, SP, NBSP, ZWSP, ENSP, ZWJ, "", “”, they all cause wrap !?
I tested with NBSP and got a good result. Don't know how did you try it? When I trying to type a NBSP I found that if you copy NBSP from a web page, the NBSP will be converted to a normal space character.
Graphics settings in zh-tw. The space after "16" was changed to a NBSP.
Graphics settings in zh-tw. The space after "16" was changed to a NBSP.
Screenshot_20210227_000907.png (101.01 KiB) Viewed 4625 times

Re: turn off space wrap on chinese

Posted: Sat Feb 27, 2021 3:27 am
by 473BFF6D
Maybe the key reference equals to a space.

And I got this on my computer!
Image

Full color setting in zh_TW looks well on my computer.

Re: turn off space wrap on chinese

Posted: Sat Feb 27, 2021 6:15 am
by eradicator
473BFF6D wrote:
Sat Feb 27, 2021 3:27 am
And I got this on my computer!
Image
Interesting and definetly broken. Also assuming that is from 1.1.25 and knowing that my screenshot is from 1.0.0, that means something changed, and like it looks not just the font/layout. Maybe someone changed the locale to break "conveniently" in the new layout.

Re: turn off space wrap on chinese

Posted: Sat Feb 27, 2021 6:39 am
by wjy
473BFF6D wrote:
Sat Feb 27, 2021 3:27 am
Full color setting in zh_TW looks well on my computer.
I'm curious about what did you see. Could you please share the screenshot?
eradicator wrote:
Sat Feb 27, 2021 6:15 am
Interesting and definetly broken. Also assuming that is from 1.1.25 and knowing that my screenshot is from 1.0.0, that means something changed, and like it looks not just the font/layout. Maybe someone changed the locale to break "conveniently" in the new layout.
According to the Crowdin activity history, someone added "\n" to the translation to force a line wrapping.
https://crowdin.com/project/factorio/ac ... on_id=7752

Re: turn off space wrap on chinese

Posted: Sun Feb 28, 2021 2:12 am
by 473BFF6D
wjy wrote:
Sat Feb 27, 2021 6:39 am
I'm curious about what did you see. Could you please share the screenshot?
The NBSP behavior is just the same as yours.

Re: turn off space wrap on chinese

Posted: Sun Feb 28, 2021 3:45 pm
by wjy
473BFF6D wrote:
Fri Feb 26, 2021 12:13 pm
I just tried no space, SP, NBSP, ZWSP, ENSP, ZWJ, "", “”, they all cause wrap !?
Here I assumed that you were out of luck from trying using NBSP.
473BFF6D wrote:
Sun Feb 28, 2021 2:12 am
The NBSP behavior is just the same as yours.
Here I assumed that you were successfully using NBSP. It's confusing to me and I'm not sure which one did you mean. I posted two screenshots before. The first one for using normal space after "16" and the second one for using NBSP after "16."

Image
Image

BTW, using NBSP or using no spaces is a double-edged sword.

I tested another configuration and found another issue when using NBSP or using no spaces. Given the following example translation:

Code: Select all

例文字16例文字例文字例文字例文字OpenGL例文字例文字。
The example would be displayed in the game as:

Code: Select all

例文字16例文字例文字例文字例文字Ope
nGL例文字例文字。
So, using NBSP or using no spaces could (still) lead to:
  1. Break a English word in default configs.
  2. Break a English word when using a different UI scale.
  3. Break a English word when a player modded the font of the game.
  4. Break a English word when the translation included a variable and changed the length dynamically.

Re: turn off space wrap on chinese

Posted: Mon Mar 01, 2021 2:35 am
by 473BFF6D
wjy wrote:
Sun Feb 28, 2021 3:45 pm
Here I assumed that you were out of luck from trying using NBSP.
No, I confirm they're all correctly inputed. My editor can show the code point under the caret.
Please try that translation under zh_CN. The colored T key may be a line breaking point.
wjy wrote:
Sun Feb 28, 2021 3:45 pm
It's confusing to me and I'm not sure which one did you mean.
"NBSP behavior" just means when NBSP is used.

Re: turn off space wrap on chinese

Posted: Mon Mar 01, 2021 4:04 am
by wjy
473BFF6D wrote:
Mon Mar 01, 2021 2:35 am
No, I confirm they're all correctly inputed. My editor can show the code point under the caret.
Please try that translation under zh_CN. The colored T key may be a line breaking point.
Thanks for clarifying. I am surprised that we were talking about two different issues:
  1. Formatted text (the colored "T" key) is like having spaces after it and behaving as a line breaking point.
  2. Current line breaking rules is not ideal for CJK (Chinese/Japanese/Korean) text and often lead to break a line at a improper position.
For the first issue, the following two examples express the difference:

Code: Select all

not-researching=按__CONTROL__open-technology-gui__打开科技面板开始新科技的研发。
The result of above translation. Tested in zh-cn.
The result of above translation. Tested in zh-cn.
Screenshot_20210301_104759.png (4.92 KiB) Viewed 4479 times

Code: Select all

not-researching=按T打开科技面板开始新科技的研发。
The result of above translation. Tested in zh-cn.
The result of above translation. Tested in zh-cn.
Screenshot_20210301_104529.png (4.82 KiB) Viewed 4479 times
The formatted one seems to have a line breaking point and the line breaking point is included in variable __CONTROL__open-technology-gui__ . The variable is not controllable by translators.

For the second issue, the first line in the tooltip is improperly broke after "16." Thus a large blank is left after the first line.
Image

Re: turn off space wrap on chinese

Posted: Mon Mar 01, 2021 6:04 am
by 473BFF6D
Well, break point at key belongs to non-ideal CJK line beraking, I think. It just causes NBSP fix won't work.