3 ms·
First rule: don't panic :) Also disclaimer: I've been working on games which were translated to >20 languages including some exotic ones, but I'm in no way an
by flohofwoe 7y ago
First rule: don't panic :)
Also disclaimer: I've been working on games which were translated to >20 languages including some exotic ones, but I'm in no way an UNICODE expert.
- most important: consider using UTF-8 as text encoding everywhere, and only encode and decode from and to other text encodings when needed (for instance when talking to APIs which don't understand UTF-8, like Windows)
- be very careful in all places where users can enter strings, and with filesystem paths, this is where most bugs happen (one of the most popular bugs is when a user has Unicode characters in his login name, and the game can't access the user's "home directory", happens to the big ones too: https://what.thedailywtf.com/topic/15579/grand-theft-auto-v-what-s-unicode-again https://what.thedailywtf.com/topic/15579/grand-theft-auto-v-...)
- get familiar with how UTF-8 encoding works and how it is "backward compatible" with 7-bit ASCII, there are good chances you don't need to change much of your old string processing code
- rendering is where it gets interesting, and here it makes sense to only do what's needed:
(1) The easiest case is American and European languages, these are all left-to-right, have fairly small alphabets and don't have complicated 'text transformation' rules
(2) East-Asian languages with huge alphabets can be a problem if you need to pre-render all font textures.
(3) The next step is languages which render from right-to-left, the interesting point is that substrings may still need to be rendered left-to-right (for instance numbers, or "foreign" strings)
(4) And finally there are languages like Arabic which rely heavily on modifying the shape of 'characters' based on where they are positioned in words or in relation to other characters, you need some sort of language-specific preprocessing of strings before you forward them to the renderer. HarfBuzz is a general solution for this problem, but it's also a lot of code to integrate (we created a specialized transformation only for Arabic).
(5) For actual rendering, all text rendering engines which can use TTF fonts are usually ready for rendering UNICODE text
So basically, the problem becomes a lot easier if you only need to support a specific set of languages.
- gmueckl 7y agoThe last part about having support for. limited numbers of languages is bigger than you probably expect. Generally, unless a software has actually been adapted to and tested with a specific language, it shouldn't claim to support it, even if is just processing UTF-8 encoded text in that language.