Struggling to understand how internationalisation is completed in games

Started by
8 comments, last by NewBreed 14 years, 10 months ago
Hi, I'm unable to get to grips with how multiple languages and keyboards are handled in games, particularly from the technical point of view and can't find any nice articles on this subject. Take the few points below for example: 1) How are the default key mappings decided in the key config screen? I can't imagine it being configured from a file for each language and keyboard layout, that'd take months for the thousands of combinations! For example, a French keyboard cannot have the default WSAD as those keys just don't make sense for that keyboard and to go further there's two keyboard types for the Japanese language, and quite a few different encoding methods many not even having the WSAD keys! 2) Similarly to the above question, when I am configuring a key and I push UP, it will actually say UP arrow. There is a Win32 method GetKeyNameText that gets the key name for the specific scan code, but this isn't too helpful as if you speak one language but your keyboard is in a different language it will return the language appropriate to the keyboard - not the language you speak. So, how are the keys given the correct names again without going through the thousands of combinations. 3) How are things like WM_KEYDOWN, WM_CHAR etc. handled in respect to many languages and many keyboard layouts? It seems that both articles and good quality sample code are rare! Cheers! NB. [Edited by - NewBreed on June 21, 2009 2:41:20 AM]
Advertisement
you should look at the DirectInput Action Mappings. That should help you a lot.

Everything is better with Metal.

As for text localisation, your text strings are stored in a database, and you have to provide translations for a set of languages yo wish to support. That is indeed a lot of work!

Everything is better with Metal.

Hi Oliii,

Thanks, although Microsoft seems to be recommending just using the Windows Message Loop as opposed to DirectInput, and from what I can gather it is meant to be easier! (Ha!). I can't see how a company can support all keyboard layouts (over 100), and then for each give each key an appropriate name for the given language. Having 5 languages would mean 500 configuration and translation files, that's too many to put and it would cost nothing short of a mortgage getting everything translated.

Somebody somewhere must have addressed these issues and put their findings on the net for all to see... Also, just the amount of foreign programmers who work on games (even at this site) should surely mean stuff like this is common knowledge, but I'm having great difficulty tracking down anything of the sort.

Thanks,
NB.
Quote:Original post by NewBreed
1) How are the default key mappings decided in the key config screen? I can't imagine it being configured from a file for each language and keyboard layout, that'd take months for the thousands of combinations!


That's not an internationalization topic. It's a localization one. And from everything I understand, it's just a file. And realistically, there's not thousands of combinations. The business people who decide to release a product will pick and choose what countries it is profitable to do the localization. Then those dozen or so at most get localization treatment (usually by a 3rd party company).

Quote:
2) Similarly to the above question, when I am configuring a key and I push UP, it will actually say UP arrow. There is a Win32 method GetKeyNameText that gets the key name for the specific scan code, but this isn't too helpful as if you speak one language but your keyboard is in a different language it will return the language appropriate to the keyboard - not the language you speak. So, how are the keys given the correct names again without going through the thousands of combinations.


Again, business requirements determine what localization is done. It's not profitable to support that one wierdo who is playing a german game on a french keyboard. Assuming that someone who is using a french keyboard knows enough french to know what the keynames are isn't a unreasonable assumption either.
Hi Telastyn,

Thanks for the reply - ok that makes a bit of sense. Lets see if I've got this correct. Say a game is being released in the UK, Germany and Japan, we would have the following files:

UK-English | UK Standard Keyboard
DE-German | German QWERTY Keyboard
JP-Japanese| Japanese QWERTY Keyboard
JP-Japanese| Japanese Kana Keyboard
JP-Japanese| Japanese Katakana Keyboard

And in each of the 5 files, we would have the virtual key code and the unicode character that is represented. So if somebody had a Japanese Kana keyboard but their input language was set to UK-English then we'd default to the UK Standard Keyboard as there is no file for (UK-English | Japanese Kana Keyboard).

Would you imagine the above being correct?

Thanks,
NB.
Something like that. I've personally not done much with keyboard variants so don't know the scope for those changes or how/what sane defaults are.
Quote:Original post by NewBreed
So if somebody had a Japanese Kana keyboard but their input language was set to UK-English then we'd default to the UK Standard Keyboard as there is no file for (UK-English | Japanese Kana Keyboard).
I am not sure there would be a sensible way to supply a combined file, anyway - how are you going to name the Japanese keys, apart from with their native characters? There may be some sort of phonetic translation for that particular combination, but there probably isn't in the general case.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

i think you lot have completely missed one really important thing.

the keys you press on the kb get sent as a code, which is then translated using a character set, into a character.

but wait, i hear you cry, how does unicode work!, well, actually the keyboard driver is doing a key_scan_code->unicode mapping based on the selected current language. so, the key code for the W key on your US english keyboard, will generate the same key code, as the key in that position in chinese. The scan code is then mapped to the correct output character using the current character set lookup, which can then be rendered on the display device (by you, or the OS).

theres a function GetAsyncKeyState which will get you the scan code. (http://msdn.microsoft.com/en-us/library/ms646293(VS.85).aspx)

yay for localisation.


also, using a string table is generally a good idea. it means localisation is easy, and makes it very easy to change the strings in your game! highly recommended++ (says mr localisation)
your never as good as they say you were, never as bad as they say you was.
That's cleared a lot up - thank you all! :)

This topic is closed to new replies.

Advertisement