*include stdio.h in a couple files for MinGW GCC 4.4.0
[supertux.git] / src / lisp / parser.cpp
index 52e87b2..4f7697c 100644 (file)
@@ -30,6 +30,8 @@
 #include "lisp.hpp"
 #include "obstack/obstackpp.hpp"
 
+#include "gameconfig.hpp"
+
 namespace lisp
 {
 
@@ -39,6 +41,7 @@ Parser::Parser(bool translate)
   if(translate) {
     dictionary_manager = new TinyGetText::DictionaryManager();
     dictionary_manager->set_charset("UTF-8");
+    if (config && (config->locale != "")) dictionary_manager->set_language(config->locale);
   }
 
   obstack_init(&obst);
@@ -104,7 +107,7 @@ Parser::parse_error(const char* msg) const
 {
   std::stringstream emsg;
   emsg << "Parse Error at '" << filename << "' line " << lexer->getLineNumber()
-         << ": " << msg;
+       << ": " << msg;
   throw std::runtime_error(emsg.str());
 }
 
@@ -114,7 +117,7 @@ Parser::read()
   Lisp* result;
   switch(token) {
     case Lexer::TOKEN_EOF: {
-         parse_error("Unexpected EOF.");
+      parse_error("Unexpected EOF.");
     }
     case Lexer::TOKEN_CLOSE_PAREN: {
       parse_error("Unexpected ')'.");
@@ -134,7 +137,7 @@ Parser::read()
         // evaluate translation function (_ str) in place here
         token = lexer->getNextToken();
         if(token != Lexer::TOKEN_STRING)
-                 parse_error("Expected string after '(_'");
+          parse_error("Expected string after '(_'");
 
         result = new(obst) Lisp(Lisp::TYPE_STRING);
         if(dictionary) {
@@ -148,7 +151,7 @@ Parser::read()
         }
         token = lexer->getNextToken();
         if(token != Lexer::TOKEN_CLOSE_PAREN)
-                 parse_error("Expected ')' after '(_ string'");
+          parse_error("Expected ')' after '(_ string'");
         break;
       }