📜 ⬆️ ⬇️

Aspects of localization. Major developer errors

As the first article showed, the theme of localization of games worries the hearts of many. The stormy nostalgic memories of Habrovchan called for the active work of one of the translators, one might say, the legendary game “UnbelieverHudo” , and hopefully together we can satisfy the interest of readers and realize a small cycle of articles.
It seems to me that it would be nice to break the material into two types:

So, again, I will raise the question of why the creations of “pirate localization” are often so scary looking, and what prevented us from doing everything humanly.

How many wonderful discoveries are brought to us by a developer-friend ...

Almost the most basic part of localization is all that is connected with the text and its display on the screen. And it would seem that there is difficult? I pulled out the text, translated it, put it back and hurray - the game is ready. But at this stage, it turns out, many surprises may lie in wait.

Foreign games, especially old ones, under DOS, were overwhelmingly written exclusively for one language - English. The developers did not bother thinking through the processing and text output system. Strings in many cases use single-byte encoding:
char * textString = ”Some text”
So what's wrong with that? All is well, but only the value of char lies in the range from -128 to 127. Because Russian letters in cp1251 coding have codes 0xC0..0xFF, they will be considered by the program as negative numbers. Often, the developers on the incoming lines put a filter that skips a range of letters and symbols only in English (0x20..0x7f), and it is clear that Russian letters will be simply omitted. To overcome this problem, you have to search all the places where lines are processed in exe's and rewrite signed operations with unsigned (usually replacing MOVSX with MOVZX), change filter ranges and so on. But it takes a lot of time and is not always possible in full.
In addition to these problems, there are also others related to the difference in the processing of letters in different languages. For example, there are games where the developers decided that the menu where all items are written in large letters looks prettier. Excellent, but they forcibly translate text into upper case using their function, which does not always work correctly with the Russian language. And as a result, for example, instead of the word “DOWNLOAD” on the screen is displayed something like “STRAIGHT” or any other surprises.
')
Recall Chernyshevsky and ask the same question "What to do?".
Best to use Unicode. But if you use it, it is right and to the full.
Often it has been possible to meet games in which resources are stored in two-byte UTF-16 encoding, but this is where the happiness ends. Because the developers were too lazy to rewrite the code and used old practices where single-byte strings are processed. What does this look like? In the worst case, the input Unicode string passes the ingenious function of the developer where the first byte is taken from the two-byte code and entered into a new line. This, in principle, works for English and European languages ​​(0x0020..0x00FF), but Russian letters will not pass (0x410..0x44F). In order not to suffer much, you can recode Russian text from cp1251 to double byte. That basically solves this problem, but sometimes gives another. For example, the game uses system TTF fonts, and on the screen, instead of Russian, we will see a set of European characters (something like Âäçèáâ). But more about that later. How to treat? Rewrite the function and use the normal WideCharToMultiByte and MultiByteToWideChar system transformations with the correct character tables. All this concerns both UTF-16 and UTF-8.

In general, the correct use of system functions should become a habit for a developer who wants to promote his product to other language regions. How many problems creates short-sighted development. For example, at the very beginning there were games that simply did not want to run on the Russian Windows system. For example, one of the glitches - the developers chose from the list of DirectX video adapter for its English name, whereas in Russian Windows it is issued in Russian. In principle, the method is generally wrong, but was applied. Some mistakes do not want to understand to this day. How many problems have you had when the game does not want to be saved in the Russian version of Windows? The problem is very simple, but it manifests itself both in official localizations and in pirated ones. The fact is that the game is trying to save files in the "My Documents" folder. But due to the incorrect conversion of encodings, the Russian name of the My Documents folder becomes a character set that cannot be used as a file name and the system returns an error to the game. I met the “tricky” solution to the problem several times - instead of the “My Documents” folder, we used the “Application Data” folder which is in all English versions of Windows. But even here problems occur, if the user used Russian letters in his login, we get something like “Documents and Settings \ User \ Application Data” which again leads to an error. If you are a player and are faced with this, it remains only to rename the folder "My Documents" to something English and use the login only in English. If you want to correct the error, you need to find a place to handle the save and patch the path forcibly. For example, "% s \ GameName \ SaveData" where the% s parameter is most likely to be replaced with the path to "My Documents" can be written as "C: \ GameName \ SaveData". The game will not be offended, and will be saved. (True, this may entail an access violation if the player does not have administrator rights).

Another surprise may lie in wait if the developer decides that using file names instead of localized strings is a good idea. Here it is very important to correctly handle the encoding tables, otherwise you can get an effect, which seems to be the file name in Russian, and it’s not clear what appears in the game. Or you save the file from the game, with a normal Russian name, and something appears on the disk - which then cannot even be deleted. Or not at all. The simplest example is saving a Player profile. Very often, it is left in English and not from a good life. To be honest with non-English file names, I have a special relationship since the days when Norton Disk Doctor successfully “cured” such files. The program is gone, but the habit has remained - I still try not to use Russian letters in file names.

Also one of the interesting problems that has not been solved in many games to this day. Keyboard input. In Russian Windows, the standard is that the Russian layout is the main one. And after starting the game it often happens that the character does not want to move. If you read the readme, you can find a modest mention of the fact that "it is recommended to choose the English layout as the default layout." I'm not even talking about the fact that it is difficult to print something in Russian, for example, in a game chat. But lately, fortunately, this is already a rarity.

And finally, in this section, remember this situation. You bought the official localization of the game, happily came home, installed, launched - and there everything is in English. That's a shame: (It's all a matter of some developers' brilliant ideas. In their opinion, the language in the game should be the same as in regional settings. But it's a shame that if I have English Windows and regional settings are not “Russia” but play do you want to speak Russian? Well, if there is a choice of language within the game, but it happens that there is no. The implementation of such an algorithm is based on the GetSystemDefaultLangID function which returns the current language code in the system.Further follows the table of available languages ​​in the game, and if there is no language, English is selected . Treat the possible resetting the regional settings as advised in the readme sometimes (and this is just to start the game!) If you do not want to change their system at the whim of the game, you can find this function call and switch to the desired result.

Enough for today. In the next series, read the free narration about the fascinating process of dubbing games, and also the story of whether pirated localization differs from the official one?

Source: https://habr.com/ru/post/278833/


All Articles