For the final project of Software and Games Localization class, we worked in a team of three and localized an open source Tetris game written in Java. The source code was acquired on here on Git Hub. We localized the game into Chinese, Spanish and Russian. Before localization, the game UI looks like this:
- Eclipse: We used Eclipse in order to edit the source code and see a real-time preview of the outcome. Eclipse also helped us to figure out the original main class of the game.
- Resource Bundle: We used PropertyResourceBundle class to store localized strings in standard Java property files. In the .java files, we wrapped the strings need to be translated, replaced them with a key, which relates to a corresponding translated strings in the property file. (see below)
(one wrapped string in .java file)
(corresponding key and string in .property file.)
1. Wrap strings
2. Add language picker
Main Challenges Met:
- How to switch language.
Because of the string externalization function of Eclipse, we don’t have to manually wrap every single string. So how to switch language become our first major challenge. We can’t decide on two methods: adding a language switching menu in the game UI or adding another control button to the game. But since none of us learned java before, we feel that our hands are tied. We are hesitant to modify the source code at the risk of breaking the game. Luckily, one of our classmates suggests us writing a new java class file as language picker and the new main class of the game. By doing this, we now start the game through language picker, rather than through running the original main game java file.
After researching on basic java coding knowledge, and with the help of our classmates, we added frame, panel and buttons to our language picker window. We are also able to customize it a little bit to fit in the style of the game itself.
(Language picker window before and after customization)
By clicking any of the language buttons, the program will look for the corresponding language property file, load it, and run the game in that language. Please check out this video to see us navigating among languages using language picker.
The second main challenges we met and solved is truncation in Russian and Spanish. Before adjusting anything, the Russian game looks like this:
The abnormal kerning let us easily identified the first problem: the font. After changing the font into one that displays well in Russian, the only problem left is inserting line breaks. We thought it can be easily done by inserting “\n” in the property files, but it didn’t work. Instead of giving us line breaks, this move gives us wired “\n” s in the texts on game UI. We thought this might because that the program does not read the property files as code but as texts, so we start working in the source code. We solved this problem by separating one long string into two and manually adjust the location of the strings. This solution is very manual, and doesn’t work well in auto aligned strings, but it solved most of the truncation problems we had in this project.
（breaking one string into two and manually set locations）
(Game UI before and after inserting the line breaks)