wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src config.cpp


From: Yann Dirson
Subject: [Wesnoth-cvs-commits] wesnoth/src config.cpp
Date: Sat, 04 Sep 2004 04:33:29 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Yann Dirson <address@hidden>    04/09/03 21:05:37

Modified files:
        src            : config.cpp 

Log message:
        implemented textdomain switch using textdomain= in wml

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/config.cpp.diff?tr1=1.103&tr2=1.104&r1=text&r2=text

Patches:
Index: wesnoth/src/config.cpp
diff -u wesnoth/src/config.cpp:1.103 wesnoth/src/config.cpp:1.104
--- wesnoth/src/config.cpp:1.103        Sun Aug 29 11:12:20 2004
+++ wesnoth/src/config.cpp      Fri Sep  3 21:05:36 2004
@@ -1,4 +1,4 @@
-/* $Id: config.cpp,v 1.103 2004/08/29 11:12:20 isaaccp Exp $ */
+/* $Id: config.cpp,v 1.104 2004/09/03 21:05:36 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -33,6 +33,7 @@
 #include "log.hpp"
 #include "scoped_resource.hpp"
 #include "util.hpp"
+#include "wesconfig.h"
 
 bool operator<(const line_source& a, const line_source& b)
 {
@@ -554,6 +555,8 @@
        std::stack<int> element_locs;
        std::stack<config*> elements;
        std::stack<std::map<std::string,config*> > last_element; //allows 
[+element] syntax
+       std::stack<std::string> textdomains;
+       std::string current_textdomain = PACKAGE;
        elements.push(this);
        element_names.push("");
        element_locs.push(0);
@@ -636,6 +639,15 @@
 
                                                last_element.top()[name] = 
element;
 
+                                               if 
(element->values["textdomain"] != "") {
+                                                       std::cerr << "out of " 
<< element
+                                                            << ", restoring 
from textdomain "
+                                                            << 
current_textdomain;
+                                                       current_textdomain = 
textdomains.top();
+                                                       textdomains.pop();
+                                                       std::cerr << " to " << 
current_textdomain << "\n";
+                                               }
+
                                                state = IN_ELEMENT;
 
                                                break;
@@ -734,6 +746,14 @@
                                        } else {
                                                vars.push_back(var);
                                                values.push_back(value);
+                                               if (var == "textdomain") {
+                                                       
textdomains.push(current_textdomain);
+                                                       current_textdomain = 
value;
+                                                       
bindtextdomain(current_textdomain.c_str(),
+                                                                      
get_intl_dir().c_str());
+                                                       std::cerr << 
"textdomain = " << value << " in "
+                                                                 << 
element_names.top() << "\n";
+                                               }
                                        }
 
                                        //iterate over the names and values, 
assigning each to its corresponding
@@ -754,7 +774,8 @@
                                                        }
 
                                                        if(translatable) {
-                                                               value = 
sgettext(value.c_str());
+                                                               value = 
dsgettext(current_textdomain.c_str(),
+                                                                               
  value.c_str());
                                                        }
 
                                                        if(n < vars.size()) {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]