[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth src/gettext.cpp src/gettext.hpp src/mul...
From: |
Isaac Clerencia |
Subject: |
[Wesnoth-cvs-commits] wesnoth src/gettext.cpp src/gettext.hpp src/mul... |
Date: |
Fri, 27 Aug 2004 07:18:26 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Isaac Clerencia <address@hidden> 04/08/27 11:13:38
Modified files:
src : gettext.cpp gettext.hpp multiplayer.cpp
po : Makevars
Log message:
Added support for variables in string translation, basically:
string_map i18n_symbols;
i18n_symbols["login"] = preferences::login();
name_entry_.assign(new gui::textbox(disp_,width-20,
vgettext("$login's game", i18n_symbols)));
Modified po/Makevars to found vgettext translated strings
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/gettext.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/gettext.hpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer.cpp.diff?tr1=1.116&tr2=1.117&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/po/Makevars.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
Patches:
Index: wesnoth/po/Makevars
diff -u wesnoth/po/Makevars:1.3 wesnoth/po/Makevars:1.4
--- wesnoth/po/Makevars:1.3 Sat Aug 21 22:33:43 2004
+++ wesnoth/po/Makevars Fri Aug 27 11:13:38 2004
@@ -8,7 +8,7 @@
top_builddir = ..
# These options get passed to xgettext.
-XGETTEXT_OPTIONS = --from-code=UTF-8 --sort-by-file --keyword=sgettext
+XGETTEXT_OPTIONS = --from-code=UTF-8 --sort-by-file --keyword=sgettext
--keyword=vgettext
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
Index: wesnoth/src/gettext.cpp
diff -u wesnoth/src/gettext.cpp:1.2 wesnoth/src/gettext.cpp:1.3
--- wesnoth/src/gettext.cpp:1.2 Sat Aug 21 22:03:25 2004
+++ wesnoth/src/gettext.cpp Fri Aug 27 11:13:37 2004
@@ -14,3 +14,11 @@
}
return msgval;
}
+
+const char* vgettext (const char *msgid, const string_map& symbols)
+{
+ const std::string orig(gettext(msgid));
+ const std::string msg = config::interpolate_variables_into_string(orig,
+ &symbols);
+ return msg.c_str();
+}
Index: wesnoth/src/gettext.hpp
diff -u wesnoth/src/gettext.hpp:1.1 wesnoth/src/gettext.hpp:1.2
--- wesnoth/src/gettext.hpp:1.1 Sat Aug 21 14:19:38 2004
+++ wesnoth/src/gettext.hpp Fri Aug 27 11:13:37 2004
@@ -1,9 +1,12 @@
#ifndef GETTEXT_HPP_INCLUDED
#define GETTEXT_HPP_INCLUDED
+#include "config.hpp"
+
// gettext-related declarations
#include <libintl.h>
const char* sgettext (const char*);
+const char* vgettext (const char*,const string_map&);
#define _(String) gettext(String)
#define gettext_noop(String) String
#define N_(String) gettext_noop (String)
Index: wesnoth/src/multiplayer.cpp
diff -u wesnoth/src/multiplayer.cpp:1.116 wesnoth/src/multiplayer.cpp:1.117
--- wesnoth/src/multiplayer.cpp:1.116 Wed Aug 25 02:59:51 2004
+++ wesnoth/src/multiplayer.cpp Fri Aug 27 11:13:37 2004
@@ -1,4 +1,4 @@
-/* $Id: multiplayer.cpp,v 1.116 2004/08/25 02:59:51 Sirp Exp $ */
+/* $Id: multiplayer.cpp,v 1.117 2004/08/27 11:13:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -172,7 +172,10 @@
//Name Entry
ypos += font::draw_text(&disp_,disp_.screen_area(),12,font::GOOD_COLOUR,
_("Name of game") +
std::string(":"),xpos,ypos).h + border_size;
- name_entry_.assign(new gui::textbox(disp_,width-20,sgettext("game name
prefix^") + preferences::login() + sgettext("game name suffix^'s game")));
+ string_map i18n_symbols;
+ i18n_symbols["login"] = preferences::login();
+ name_entry_.assign(new gui::textbox(disp_,width-20,
+ vgettext("$login's game", i18n_symbols)));
name_entry_->set_location(xpos,ypos);
name_entry_->set_dirty();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth src/gettext.cpp src/gettext.hpp src/mul...,
Isaac Clerencia <=