#Theme/Font handling for Localisation

6 messages · Page 1 of 1 (latest)

silent loom
#

Hello, i want to localise my game in several languages.
Current state:
Im having several Themes for different Stuff(UI/Starting Screen/other stuff)
I am using one Font for everything and have a singleton for loading/applying the language. Currently only english and german.
I already have the problem of öäü in german, which my current font doesnt support, but i just ignored it for now.
Bigger problems arise when i want to use japanse/simplified chinese.
As i didnt pay that much attention in the beginning, i made a pretty chaos with Themes and Theme overrides.
I have the languages in a .csv with key -> translation mapping i.e. STARTING_MENU <-> en <-> Starting Menu ( de <-> Startmenü)

So my questions are:
Whats a good way to handle Fonts in that context? Should i only use one Theme for the whole game? This sounds somewhat wrong. Are there Fonts which support all languages? My research says no.
My approach would be:
Attach one Parent node in every ("main")Scene with the "default theme", which have the font/font size. I apply the correct one through code(somewhat like if japanese: theme.font = japanesefont etc.). Delete font & font size in every other theme i have(as said, its a bit chaotic, i have stuff set up here and there, overrides...etc.).

Idk if thats ok, good, bad...maybe someone has advice for that? Im also willing to rework everything, tho i want to avoid that...

Thanks/Danke in advance for any tips.

ivory ingot
#

Um... Without putting too much deep thought into it, I would suggest finding the greatest extents required for the most space-using language/font, and building as much around that as possible, understanding that for ones that take up less there will be a lot of extra space. It's probably the simplest solution. It's a one-person-doable idea that I can think of. I'd say you might want to use a helper method whenever loading or setting the text in a field. That method can just fetch a translation for the current language setting, then. The singelton autoload is a good enough pattern for this.
For fonts, that's a situation where you just definitely need at bare-minimum, one font that has characters for the language you support. This is almost-definitely going to require switching fonts. Luckily, you can store LabelSettings resources with fonts/sizes configured for this. So, making a registry of those (maybe a const Dictionary of UIDs for the LabelSettings resources that are keyed with the names of the languages) is a good idea.

#

This is almost definitely not as easy as I have framed it here. Good luck, though.

#

I mean, the technical side of wiring it up is. Getting good translation across your entire game is the hard part, probably.

ivory ingot
#

Oh, also forgot to highlight something about those LabelSettings, they can allow you to associate a specific font-size with a particular language/font, too, becaues you get to adjust size right in the resource's properties.

silent loom
#

Afaik Richtextlabel doesnt support LabelSettings or am i misled?