Archived

This topic is now archived and is closed to further replies.

atcdevil

i18n in C++

Recommended Posts

Does anyone know of any simple tutorials on internationalization as it applies to programming in C++. I''ve looked at references on GNU gettext, Unicode, and wchar_t. Unfortunately I''ve been totally unsuccesful in even getting a program to get a simple Hello World program to switch between displaying Hello World and Hola Mundo. Eventually I would like to eventually be able to support any language I could find a translator for. Thanks, Andrew

Share this post


Link to post
Share on other sites
You'll need something like the C++ locales for string and numeric handling:

http://www.research.att.com/~bs/3rd_loc0.html
http://www.amazon.com/exec/obidos/tg/detail/-/0201183951/102-0574646-8345703?v=glance (a book you can buy)
http://www.tacc.utexas.edu/services/userguides/pgi/pgC++_lib/stdlibug/sta_9169.htm

As for translation, you pretty much have to maintain individual tables of strings, one for each language. Most projects I've seen just index into an array of strings (one array per language) or call a function with a constant referring to the message and some sort of internal state remembering what language you're using. Gettext seems massively complex for what it does, and while I'm not claiming that every feature there is not useful, I'm not entirely convinced it's all important.

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]


[edited by - Kylotan on January 24, 2004 6:31:14 PM]

[edited by - Kylotan on January 24, 2004 6:35:19 PM]

Share this post


Link to post
Share on other sites