Update of /cvsroot/super-tux/supertux/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6618/src
Modified Files:
lispreader.cpp
Log Message:
Added support for data files internationalization by a simple 3 lines code in lispreader's read_string().
To translate a level's title to European Portuguese, I would look at:
(title "Hello World!")
and add:
(title-pt_PT "Olá Mundo!")
Also, made display_text_file() using lispreader (to make it i18n too). Unfortunately, there is a crash of lisp_reader in my system (not related), so I wasn't able to give it a try.
data/*.txt files also need updating to work. Else, it should just skip it, without crashing.
Index: lispreader.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/lispreader.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- lispreader.cpp 29 Jun 2004 12:12:24 -0000 1.26
+++ lispreader.cpp 7 Jul 2004 19:19:19 -0000 1.27
@@ -1208,7 +1208,13 @@
bool
LispReader::read_string (const char* name, std::string& str)
{
- lisp_object_t* obj = search_for (name);
+ char str_[1204];
+ sprintf(str_, "%s-%s", name, getenv("LANG"));
+ lisp_object_t* obj = search_for (str_);
+
+ if(!obj)
+ obj = search_for (name);
+
if (!obj)
return false;
|