View Full Version : Internanionalization tools and resources for C++
Kai-Peter
06-07-2004, 08:30 AM
What C++ tools and resources are you using for internationalization, ie. mainly handling resource bundles and in-game text?
princec
06-07-2004, 08:54 AM
Shouting loudly in English and waving my arms.
Cas :)
ggambett
06-07-2004, 10:08 AM
I'm facing this myself... although I haven't solved it yet, what I'm doing is :
1) Rewrote font rendering code, use SDL_TTF now (this takes care of all the weird characters).
2) Have everything in text files (if you want to show how cool you are, use a XML file). Do not have literals in the sources, but use App::getString(sStringID).
3) Have separate resource files (my equivalent to a .pak file or whatever) for each language (I do for text buttons), with images named equally in all the languages. Load just one at runtime.
4) [TODO] Write or adapt a unicode string class!
ggambett
06-07-2004, 10:14 AM
And this http://www.joelonsoftware.com/articles/Unicode.html is a good starting point
Lizardsoft
06-07-2004, 11:23 AM
So far I've simply switched to using TCHAR (and created similiar typedefs for std::string and other string related STL classes). This provides some hope for one day being able to use unicode without rewriting tens of thousands of lines of code. The stuff in Joel's article is exactly the stuff that makes me not want to bother, especially when you throw in needing to be compatible with Windows 9x. It becomes a serious job to just display text.
I'm considering not bothering supporting Win9x/WinME in future products, and instead focusing on internationlization (probably opens up a much larger potential market now than supporting the two people that are still using Windows 98 on a modern system).
Wayward
06-07-2004, 11:48 AM
Joels article on unicode was a very entertaining read. Boy, I'm one sad geek.
Grimreaper
06-07-2004, 01:22 PM
String tables in a resource dll. Translator software can handle these.
grimreaper
Nemesis
06-07-2004, 02:30 PM
Or have UI and game dialogue text in Esperanto :)
Kai-Peter
06-08-2004, 11:00 PM
Thanks for the comments and suggestions! :)
Jack_Norton
06-08-2004, 11:27 PM
But is it really worthy internationalization for a shareware product? :confused:
I'll soon release UBM in german thanks to Iakibuk precious help, but I don't really know how this will affect the sales...
"i18n" is fortunatelly pretty easy on the Java side, because it's build-in ;)
You just put everything into ".properties" files and load em. Wich language is choosen is determined by the vm itself (it's done via suffixes like "_en_GB", "_fr", "_de", "_jp" and so on). You can either use UTF-8 or ascii with unicode escape characters ("\u00D6ffnen" becomes "Öffnen" [open]) etc. It's really neat.
A usual file menu looks like this:
[...]
file.new=Neu
file.open=\u00D6ffnen
file.close=Schlie\u00DFen
file.closeAll=Alle schlie\u00DFen
file.save=Speichern
file.saveAs=Speichern unter...
file.saveAll=Alle speichern
file.print=Drucken
file.exit=Beenden
[...]
It's put into hashtables so getting the text for file->new is just something like res.getString("file.new") :)
With C++ I would use escape chars (like shown in the example above) for the unicode stuff, because it's one headache less.
princec
06-09-2004, 03:12 AM
Shh! Don't mention the J word in a C++ thread ;)
Cas :)