adonthell-commits
[Top][All Lists]
Advanced

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

[Adonthell-commits] CVS: adonthell/src dialog.cc,1.24,1.25 game.h,1.23,1


From: Kai Sterker <address@hidden>
Subject: [Adonthell-commits] CVS: adonthell/src dialog.cc,1.24,1.25 game.h,1.23,1.24 nls.cc,1.1,1.2 nls.h,1.1,1.2 text_bubble.cc,1.5,1.6
Date: Sat, 13 Apr 2002 10:51:25 -0400

Update of /cvsroot/adonthell/adonthell/src
In directory subversions:/tmp/cvs-serv11973

Modified Files:
        dialog.cc game.h nls.cc nls.h text_bubble.cc 
Log Message:
FIXED i18n to really work independantly of any environment variable
RENAMED nls::gettext to nls::translate to avoid name clash with gettext


Index: dialog.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/dialog.cc,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** dialog.cc   13 Apr 2002 11:05:10 -0000      1.24
--- dialog.cc   13 Apr 2002 14:51:19 -0000      1.25
***************
*** 182,186 ****
              // get the text
              answer = PyInt_AsLong (PyList_GetItem (speech, rnd));
!             text_.push_back (scan_string (nls::gettext (strings[answer])));
              
              // get the NPC color
--- 182,186 ----
              // get the text
              answer = PyInt_AsLong (PyList_GetItem (speech, rnd));
!             text_.push_back (scan_string (nls::translate (strings[answer])));
              
              // get the NPC color
***************
*** 210,214 ****
                  // simply add all text to let the player select an answer
                  answer = PyInt_AsLong (PyList_GetItem (speech, i));
!                 text_.push_back (scan_string (nls::gettext 
(strings[answer])));
                  answers.push_back (answer);
              }
--- 210,214 ----
                  // simply add all text to let the player select an answer
                  answer = PyInt_AsLong (PyList_GetItem (speech, i));
!                 text_.push_back (scan_string (nls::translate 
(strings[answer])));
                  answers.push_back (answer);
              }
***************
*** 319,323 ****
          if (result)
              if (PyString_Check (result))
!                 mid = (char*) nls::gettext (PyString_AS_STRING (result));    
          
          // Replace existing with new, changed string
--- 319,323 ----
          if (result)
              if (PyString_Check (result))
!                 mid = (char*) nls::translate (PyString_AS_STRING (result));   
 
          
          // Replace existing with new, changed string

Index: game.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/game.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** game.h      7 Apr 2002 09:51:28 -0000       1.23
--- game.h      13 Apr 2002 14:51:20 -0000      1.24
***************
*** 34,38 ****
--- 34,40 ----
  #include "types.h"
  
+ #ifndef SWIG 
  using std::string; 
+ #endif
  
  /**

Index: nls.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/nls.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** nls.cc      13 Apr 2002 11:05:10 -0000      1.1
--- nls.cc      13 Apr 2002 14:51:20 -0000      1.2
***************
*** 31,41 ****
  void nls::init (config &myconfig)
  {
-     setlocale (LC_MESSAGES, "");
-     
      if (myconfig.language != "en")
          set_language (myconfig.language);
      
      // open the message catalogue
!     std::string location = myconfig.gamedir + "/po";
      bindtextdomain (myconfig.game_name.c_str (), location.c_str ());
      textdomain (myconfig.game_name.c_str ());
--- 31,39 ----
  void nls::init (config &myconfig)
  {
      if (myconfig.language != "en")
          set_language (myconfig.language);
      
      // open the message catalogue
!     std::string location = myconfig.gamedir + "/locale";
      bindtextdomain (myconfig.game_name.c_str (), location.c_str ());
      textdomain (myconfig.game_name.c_str ());
***************
*** 43,47 ****
  
  // Set the language to use
! void nls::set_language (const std::string &language)
  {
      setenv ("LANGUAGE", language.c_str (), 1);
--- 41,45 ----
  
  // Set the language to use
! void nls::set_language (const string &language)
  {
      setenv ("LANGUAGE", language.c_str (), 1);
***************
*** 54,62 ****
      }
  #endif
  }
  
  // Translate some text
! const char* nls::gettext (const std::string &text)
  {
!     return ::gettext (text.c_str ());
  }
--- 52,62 ----
      }
  #endif
+     
+     setlocale (LC_MESSAGES, language.c_str ());
  }
  
  // Translate some text
! const char* nls::translate (const string &text)
  {
!     return gettext (text.c_str ());
  }

Index: nls.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/nls.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** nls.h       13 Apr 2002 11:05:10 -0000      1.1
--- nls.h       13 Apr 2002 14:51:20 -0000      1.2
***************
*** 25,28 ****
--- 25,32 ----
  #include "prefs.h"
  
+ #ifndef SWIG
+ using std::string;
+ #endif
+ 
  /** 
   * Provides various services for i18n and l10n.
***************
*** 44,48 ****
       * @param language The country code of the desired language.
       */
!     static void set_language (const std::string &language);
      
      /**
--- 48,52 ----
       * @param language The country code of the desired language.
       */
!     static void set_language (const string &language);
      
      /**
***************
*** 54,58 ****
       *      no translation was found.
       */
!     static const char* gettext (const std::string &text);
  };
  
--- 58,62 ----
       *      no translation was found.
       */
!     static const char* translate (const string &text);
  };
  

Index: text_bubble.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/text_bubble.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** text_bubble.cc      13 Apr 2002 11:05:10 -0000      1.5
--- text_bubble.cc      13 Apr 2002 14:51:20 -0000      1.6
***************
*** 43,47 ****
      label::resize (len, 0);
      set_form (label::AUTO_HEIGHT); 
!     set_text (nls::gettext (text));
      set_visible_border (true);
      set_visible_background (true);
--- 43,47 ----
      label::resize (len, 0);
      set_form (label::AUTO_HEIGHT); 
!     set_text (nls::translate (text));
      set_visible_border (true);
      set_visible_background (true);




reply via email to

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