soc.2009.transport: 0b80dc7a: Support for xml:lang and better compatib...
hanzz at soc.pidgin.im
hanzz at soc.pidgin.im
Wed Jun 3 04:05:26 EDT 2009
-----------------------------------------------------------------
Revision: 0b80dc7a5b430754167a85ae15584cfc83d11b33
Ancestor: 24f1569e66cc7f9a925a5be641f5778ebf1e109f
Author: hanzz at soc.pidgin.im
Date: 2009-06-03T08:03:00
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/0b80dc7a5b430754167a85ae15584cfc83d11b33
Modified files:
main.cpp main.h user.cpp user.h
ChangeLog:
Support for xml:lang and better compatibility with Gettext
-------------- next part --------------
============================================================
--- main.cpp f26e479595dc50fd26fe8e5b3e55b4a52014acb2
+++ main.cpp 1d477ddfcbd637e1ed42dcfdacf8310ec359561f
@@ -163,7 +163,7 @@ static void * requestInput(const char *t
else {
if (primaryString=="Authorization Request Message:") {
Log().Get("purple") << "accepting this authorization request";
- ((PurpleRequestInputCb) ok_cb)(user_data,"Please authorize me.");
+ ((PurpleRequestInputCb) ok_cb)(user_data,tr(user->getLang(),_("Please authorize me.")));
}
else if ( primaryString == "Set your Facebook status" ) {
Log().Get("purple") << "set facebook status";
============================================================
--- main.h f097dda7f7e779a43fadfa4ddf96d78a1053f4dc
+++ main.h 7680e2aab97c4c4ba989bd73fa4b31a6476b72b2
@@ -61,7 +61,8 @@
#include <locale.h>
#define HIICQ_UI "hiicq"
-#define _(lang,STRING) localization.translate(lang,STRING)
+#define tr(lang,STRING) localization.translate(lang,STRING)
+#define _(STRING) STRING
#include "registerhandler.h"
#include "discoinfohandler.h"
============================================================
--- user.cpp fd160a467f78d548b62b563cc5b5bf94c4e4b08e
+++ user.cpp fc72a1c7fb4a1445f4ad8078de27f6633a4d704c
@@ -50,6 +50,7 @@ User::User(GlooxMessageHandler *parent,
m_connectionStart = time(NULL);
m_subscribeLastCount = -1;
m_reconnectCount = 0;
+ m_lang = NULL;
this->features = 6; // TODO: I can't be hardcoded
}
@@ -812,6 +813,14 @@ void User::receivedPresence(const Presen
}
}
+ if (m_lang == NULL) {
+ std::string lang = stanza.xmlLang();
+ if (lang == "default")
+ lang = "en";
+ setLang(lang.c_str());
+ localization.loadLocale(getLang());
+ }
+
// this presence is for the transport
if(stanza.to().username() == ""){
if(stanza.presence() == Presence::Unavailable) {
============================================================
--- user.h 901f83b26dfdfda1d36248f5d8dbf3db112c5112
+++ user.h c82e8bca2ae3d93136f61c136159bf605771bb61
@@ -129,6 +129,8 @@ class User {
AdhocData adhocData() { return m_adhocData; }
void setAdhocData(AdhocData data) { m_adhocData = data; }
std::map<std::string,RosterRow> roster() { return m_roster; }
+ const char *getLang() { return m_lang; }
+ void setLang(const char *lang) { m_lang = lang; }
GlooxMessageHandler *p;
@@ -148,6 +150,7 @@ class User {
std::string m_jid; // Jabber ID of this user
std::string m_resource; // active resource
std::string m_capsVersion; // caps version of client which connected as first (TODO: this should be changed with active resource)
+ const char *m_lang; // xml:lang
time_t m_connectionStart; // connection start timestamp
std::map<std::string,RosterRow> m_roster; // jabber roster of this user
std::map<std::string,int> m_resources; // list of all resources which are connected to the transport
More information about the Commits
mailing list