aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-12-22 15:37:51 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-12-22 15:37:51 +0800
commit6fec7fed87a7f21eacc80ea687671c4084f7b1af (patch)
tree26f5d4177bb0eb587b1d489a173ca6ff4729d3e7 /widgets
parent5ec3965b9fd39c0cb60aa880a8448e8d6e332ebf (diff)
downloadgsoc2013-evolution-6fec7fed87a7f21eacc80ea687671c4084f7b1af.tar
gsoc2013-evolution-6fec7fed87a7f21eacc80ea687671c4084f7b1af.tar.gz
gsoc2013-evolution-6fec7fed87a7f21eacc80ea687671c4084f7b1af.tar.bz2
gsoc2013-evolution-6fec7fed87a7f21eacc80ea687671c4084f7b1af.tar.lz
gsoc2013-evolution-6fec7fed87a7f21eacc80ea687671c4084f7b1af.tar.xz
gsoc2013-evolution-6fec7fed87a7f21eacc80ea687671c4084f7b1af.tar.zst
gsoc2013-evolution-6fec7fed87a7f21eacc80ea687671c4084f7b1af.zip
translate strings based on translation-domain, if supplied.
2004-12-17 Not Zed <NotZed@Ximian.com> * e-error.c (ee_load, e_error_newv): translate strings based on translation-domain, if supplied. svn path=/trunk/; revision=28179
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/ChangeLog5
-rw-r--r--widgets/misc/e-error.c33
2 files changed, 29 insertions, 9 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 38018ef811..fe113e8c5b 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,8 @@
+2004-12-17 Not Zed <NotZed@Ximian.com>
+
+ * e-error.c (ee_load, e_error_newv): translate strings based on
+ translation-domain, if supplied.
+
2004-12-14 Rodney Dawes <dobey@novell.com>
* e-calendar-item.c (e_calendar_item_draw): Use gtk_paint_foo instead
diff --git a/widgets/misc/e-error.c b/widgets/misc/e-error.c
index 1975be9c60..9c4fb4aafb 100644
--- a/widgets/misc/e-error.c
+++ b/widgets/misc/e-error.c
@@ -67,6 +67,7 @@ struct _e_error {
struct _e_error_table {
char *domain;
+ char *translation_domain;
GHashTable *errors;
};
@@ -184,13 +185,27 @@ ee_load(const char *path)
table = g_hash_table_lookup(error_table, tmp);
if (table == NULL) {
+ char *tmp2;
+
table = g_malloc0(sizeof(*table));
table->domain = g_strdup(tmp);
table->errors = g_hash_table_new(g_str_hash, g_str_equal);
g_hash_table_insert(error_table, table->domain, table);
+
+ tmp2 = xmlGetProp(root, "translation-domain");
+ if (tmp2) {
+ table->translation_domain = g_strdup(tmp2);
+ xmlFree(tmp2);
+
+ tmp2 = xmlGetProp(root, "translation-localedir");
+ if (tmp2) {
+ bindtextdomain(table->translation_domain, tmp2);
+ xmlFree(tmp2);
+ }
+ }
} else
g_warning("Error file '%s', domain '%s' already used, merging", path, tmp);
- g_free(tmp);
+ xmlFree(tmp);
for (error = root->children;error;error = error->next) {
if (!strcmp(error->name, "error")) {
@@ -224,17 +239,17 @@ ee_load(const char *path)
for (scan = error->children;scan;scan=scan->next) {
if (!strcmp(scan->name, "primary")) {
if ((tmp = xmlNodeGetContent(scan))) {
- e->primary = g_strdup(_(tmp));
+ e->primary = g_strdup(dgettext(table->translation_domain, tmp));
xmlFree(tmp);
}
} else if (!strcmp(scan->name, "secondary")) {
if ((tmp = xmlNodeGetContent(scan))) {
- e->secondary = g_strdup(_(tmp));
+ e->secondary = g_strdup(dgettext(table->translation_domain, tmp));
xmlFree(tmp);
}
} else if (!strcmp(scan->name, "title")) {
if ((tmp = xmlNodeGetContent(scan))) {
- e->title = g_strdup(_(tmp));
+ e->title = g_strdup(dgettext(table->translation_domain, tmp));
xmlFree(tmp);
}
} else if (!strcmp(scan->name, "help")) {
@@ -254,7 +269,7 @@ ee_load(const char *path)
}
tmp = xmlGetProp(scan, "label");
if (tmp) {
- b->label = g_strdup(_(tmp));
+ b->label = g_strdup(dgettext(table->translation_domain, tmp));
xmlFree(tmp);
}
tmp = xmlGetProp(scan, "response");
@@ -478,21 +493,21 @@ e_error_newv(GtkWindow *parent, const char *tag, const char *arg0, va_list ap)
out = g_string_new("");
if (e->title) {
- ee_build_label(out, _(e->title), args);
+ ee_build_label(out, dgettext(table->translation_domain, e->title), args);
gtk_window_set_title((GtkWindow *)dialog, out->str);
g_string_truncate(out, 0);
} else
- gtk_window_set_title((GtkWindow *)dialog, _(type_map[e->type].title));
+ gtk_window_set_title((GtkWindow *)dialog, dgettext(table->translation_domain, type_map[e->type].title));
if (e->primary) {
g_string_append(out, "<span weight=\"bold\" size=\"larger\">");
- ee_build_label(out, _(e->primary), args);
+ ee_build_label(out, dgettext(table->translation_domain, e->primary), args);
g_string_append(out, "</span>\n\n");
}
if (e->secondary)
- ee_build_label(out, _(e->secondary), args);
+ ee_build_label(out, dgettext(table->translation_domain, e->secondary), args);
g_ptr_array_free(args, TRUE);