Localization in SmartGo
by Anders Kierulf
Wil Shipley wrote an interesting post about localization in Delicious Monster. As this is an area where SmartGo is ahead of the curve, let me share how I do it in SmartGo.
How it looks
SmartGo is localized into a number of languages on Windows, on the iPhone, and on the web. (And yes, the Mac version is making progress.) Please take a look:
Windows: Download, install, and run the free version of SmartGo at http://www.smartgo.com/SGSetup.exe. In the Help menu, switch to German or Japanese, for example, and note that the whole UI switches on the fly. Choose Replay > Find, or File > Export Diagrams, for example, and note that the layout of the dialog adapts to the strings of the language.
iPhone: No free version, but SmartGo 9x9 is just $0.99. [Update (2012-08-19): The 9x9 version is dead, use SmartGo Player at $2.99 instead.] Tap the tools icon in the top left, then Language, and again you’ll see the UI switch on the fly. Note also how the language is listed in both local and translated versions, so that you can find your way back to English if your Chinese is a bit rusty (or non-existent, like mine).
Website: Go to http://www.smartgo.com/en/index.htm, then click on one of the languages in the top right. Note how both page content and navigation links switch appropriately. When a translation is missing, you’ll see English instead.
How it works
Code instead of resources: Instead of using resources, SmartGo builds the UI elements (menus, dialogs) on the fly as much as possible. SmartGo loads the translations from an XML file (C:\Program Files\SmartGo2\language.tmx if you installed the Windows version). In the code, instead of "New Player" you’ll find something like SgText::Str(STR_NEW_PLAYER) that retrieves the appropriate string in the current language (and returns the English string if that string has not been translated).
Automatic dialog layout: The position of dialog items is computed on the fly by specifying the layout structure in the code. For example, here’s the C++ code for the Edit > Node Name dialog:
TopBox dialog(*this, IDD, /*fVertical*/true);
StaticBox n1(content, IDC_NN_NODE_NAME_S);
EditBox n2(content, IDC_NN_NODE_NAME, 142);
ButtonBox ok(buttons, IDOK);
ButtonBox cancel(buttons, IDCANCEL);
Writing and fine-tuning the dialog layout engine is more effort up front, but it avoids endless pixel twiddling, and automatically adjusts for long strings without adding ugly extra space in English.
Website: All the pages on smartgo.com are generated by a program. This allows the navigation links and language switches to work even though I’m just using static HTML files. Creating new pages is a bit of a pain (I’m basically writing a program that creates that web page, pulling strings from the language.tmx file), but it works, and keeps everything in sync. Definitely a hack, but I have not found any good tools for maintaining a web site with more than 50 pages in 7 languages.
The other part of the equation is managing the translations. I speak German and some French, but Japanese or Chinese are Greek to me. The initial translation is not much of a problem, but updates (both added strings and corrections) are an issue. Again, not finding any good tools to help with this, I built the translation support directly into the Windows version of SmartGo. Choose Tools > Special > Translate and select language.tmx. You can edit the translations, but more importantly, you can merge translations and accept or reject changes.
There is cost and pain associated with localizing. For $0.99 games it may not be worth it. But for a quality program that you refine over years, localized versions can definitely add to your business. And when Apple launches the iPhone in China, you’re prepared.