taisei-project / taisei

A free and open-source Touhou Project fangame
https://taisei-project.org/
Other
940 stars 88 forks source link

Add languages thing #376

Open Aldair502 opened 8 months ago

Aldair502 commented 8 months ago

Idk. i mean, i could change every dialogs on https://github.com/taisei-project/taisei/tree/master/src/dialog to another language. but i don't want to make forks and edit every .c file everytime i want to use another lang

Nhalrath commented 5 months ago

A language selector? I think it's a nice addition to the game, but do we have people willing to translate the game?

I'm no professional in programming and Taisei's large codebase still overwhelms me, but maybe I can give this one a shot! It's a good opportunity to learn more about the internals of the game.

Nhalrath commented 5 months ago

I attempted to take this one today, but it looks like non-English characters are not supported. My guess is that the fonts themselves doesn't have the necessary glyphs for these. screenshot

I'm not familiar with how fonts are handled, so I guess I'll pass on this one.

Akaricchi commented 5 months ago

Taisei's text renderer can handle non-English characters just fine, but the font we're using indeed doesn't support any CJK characters. GUI applications typically fall back to other fonts when the desired one is missing glyphs. Unfortunately, Taisei does not support this yet; we can only draw with one font at a time. Adding a fallback system is possible, but non-trivial… anything to do with text rendering is generally more complicated than you'd expect.

The idea of supporting localization came up quite a few times. I'd like to tackle it eventually, but it's a low-priority thing for now. I definitely want to finish the extra stage and finalize all the dialogue before starting on localization.

For the brave and adventurous: if you want to try implementing font fallback yourself, start here. Everything to do with font loading, glyph caching, and text drawing is currently in that file. And always feel free to ask me on Discord or by email about any aspect of the codebase.

Firestar-Reimu commented 3 months ago

Yes, I wish to make a Chinese translation (as non-CJK characters are too out-of-character when playing this game), and the Chinese/Japanese font can use the open source Source Han Sans.