earth2java icon indicating copy to clipboard operation
earth2java copied to clipboard

breakLine method breaks CJK translation wrapping

Open deluxghost opened this issue 3 years ago • 3 comments

https://github.com/Slexom/earth2java/blob/f66015d53e235d94c2031618bf5d8a934caa35ae/common/src/main/java/slexom/earthtojava/utils/Utils.java#L52-L60

This method breaks long item descriptions into short lines with a max of 40 chars per line, which is not working on (at least) CJK translations.

CJK: Chinese/Japanese/Korean (zh_cn, zh_tw, ja_jp, ko_kr)

Let's try zh_tw as an example, here is an item description:

https://github.com/Slexom/earth2java/blob/f66015d53e235d94c2031618bf5d8a934caa35ae/common/src/main/resources/assets/earthtojavamobs/lang/zh_tw.json#L63

Check it in game:

image

It says:

幾年前,一群遠征的探險家發現了一種稀有的怪雞,這種雞的身上長滿了蘑菇,因
。這是一種非常奇怪的雞。但是好不好吃?我們只能等時間來證明了。

And a piece of text is gone:

幾年前,一群遠征的探險家發現了一種稀有的怪雞,這種雞的身上長滿了蘑菇,因
此命名為咕咕菇      <---------------- THIS
。這是一種非常奇怪的雞。但是好不好吃?我們只能等時間來證明了。

deluxghost avatar Jul 20 '22 18:07 deluxghost

For those languages I can break the description at the end of a sentence instead of a fixed length of characters/words. There could be some very large box, but it is better than a broken description.

image

image

image

Slexom avatar Jul 20 '22 22:07 Slexom

IMO, since Korean also uses spaces to separate words, it might be ok to use the same rule as latin languages, but with less max line length.

And for Chinese / Japanese, they don't have any word separator, it's already good to break lines from anywhere in a sentence, with less line length too.

e.g. This is good

幾年前,一群遠征的探險家發現了一種稀有的怪
雞,這種雞的身上長滿了蘑菇,因此命名為咕咕
菇。這是一種非常奇怪的雞。但是好不好吃?我
們只能等時間來證明了。

if you want to make it better, just don't let any line start with punctuation

e.g. This is not so good (second line)

幾年前,一群遠征的探險家發現了一種稀有的怪雞
,這種雞的身上長滿了蘑菇,因此命名為咕咕菇。
這是一種非常奇怪的雞。但是好不好吃?我們只能
等時間來證明了。

deluxghost avatar Jul 21 '22 02:07 deluxghost

another valid workaround is, we don't wrap text ourselves, and let mods like this handle all these mess

deluxghost avatar Aug 17 '22 09:08 deluxghost