From 72dbc81f48008909473e67eb23e61e05ff4d8057 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 12 May 2004 03:36:37 +0000 Subject: make the Because cases the same. 2004-05-12 Not Zed * e-system-errors.xml: make the Because cases the same. * e-system-errors.xml.h: add for translators. * e-error.c (ee_load): just use _() to do i18n rather than the nasty lang stuff. (find_node): no longer needed. * Makefile.am (%.xml.h): setup the build rules for the i18n file for the errors. * e-system-errors.xml.in: Removed, renamed to .xml and removed the _ stuff. svn path=/trunk/; revision=25871 --- widgets/misc/ChangeLog | 16 ++++++++ widgets/misc/Makefile.am | 12 +++--- widgets/misc/e-error.c | 73 ++++++++----------------------------- widgets/misc/e-system-errors.xml | 22 +++++++++++ widgets/misc/e-system-errors.xml.h | 15 ++++++++ widgets/misc/e-system-errors.xml.in | 22 ----------- 6 files changed, 76 insertions(+), 84 deletions(-) create mode 100644 widgets/misc/e-system-errors.xml create mode 100644 widgets/misc/e-system-errors.xml.h delete mode 100644 widgets/misc/e-system-errors.xml.in (limited to 'widgets') diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index cd91a192ee..b8bd494a42 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,19 @@ +2004-05-12 Not Zed + + * e-system-errors.xml: make the Because cases the same. + + * e-system-errors.xml.h: add for translators. + + * e-error.c (ee_load): just use _() to do i18n rather than the + nasty lang stuff. + (find_node): no longer needed. + + * Makefile.am (%.xml.h): setup the build rules for the i18n file + for the errors. + + * e-system-errors.xml.in: Removed, renamed to .xml and removed the + _ stuff. + 2004-05-04 Xan Lopez * Makefile.am: diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am index cacf891cba..57b552b67a 100644 --- a/widgets/misc/Makefile.am +++ b/widgets/misc/Makefile.am @@ -72,10 +72,11 @@ libemiscwidgets_la_SOURCES = \ MARSHAL_GENERATED = e-util-marshal.c e-util-marshal.h @EVO_MARSHAL_RULE@ -error_in_files = e-system-errors.xml.in -error_DATA = $(error_in_files:.xml.in=.xml) +error_DATA = e-system-errors.xml +error_i18n = $(error_DATA:.xml=.xml.h) errordir = $(privdatadir)/errors -@INTLTOOL_XML_RULE@ +%.xml.h: %.xml + $(top_builddir)/e-util/e-error-tool $^ libemiscwidgets_la_LIBADD = $(top_builddir)/e-util/libeutil.la \ $(top_builddir)/a11y/widgets/libevolution-widgets-a11y.la \ @@ -176,11 +177,12 @@ test_error_LDADD = \ $(GNOME_FULL_LIBS) -BUILT_SOURCES = $(MARSHAL_GENERATED) $(error_DATA) +BUILT_SOURCES = $(MARSHAL_GENERATED) $(error_i18n) CLEANFILES = $(BUILT_SOURCES) EXTRA_DIST = \ - $(error_in_files) \ + $(error_DATA) \ + $(error_i18n) \ e-util-marshal.list \ ChangeLog.pre-1-4 diff --git a/widgets/misc/e-error.c b/widgets/misc/e-error.c index a456802be4..0caceb37d1 100644 --- a/widgets/misc/e-error.c +++ b/widgets/misc/e-error.c @@ -133,44 +133,6 @@ map_type(const char *name) return 3; } -static const GList *lang_list; - -/* Finds the right node for the current language. */ -static xmlNodePtr -find_node(xmlNodePtr base, const char *name) -{ - const GList *l; - xmlNodePtr scan, langc=NULL; - - if (lang_list == NULL) - lang_list = gnome_i18n_get_language_list("LC_MESSAGES"); - - /* This is, like, way shitful, very slow, terribly inefficient ... sigh */ - for (l=lang_list;l;l=l->next) { - const char *lang = l->data; - - for (scan = base;scan;scan=scan->next) { - if (!strcmp(scan->name, name)) { - char *xmllang = xmlGetProp(scan, "xml:lang"); - - if (xmllang) { - if (!strcmp(xmllang, lang)) { - xmlFree(xmllang); - return scan; - } - xmlFree(xmllang); - } else { - langc = scan; - if (strcmp(lang, "C") == 0) - return scan; - } - } - } - } - - return langc; -} - /* XML format: @@ -254,26 +216,23 @@ ee_load(const char *path) xmlFree(tmp); } - node = find_node(error->children, "primary"); - if (node && (tmp = xmlNodeGetContent(node))) { - e->primary = g_strdup(tmp); - xmlFree(tmp); - } - - node = find_node(error->children, "secondary"); - if (node && (tmp = xmlNodeGetContent(node))) { - e->secondary = g_strdup(tmp); - xmlFree(tmp); - } - - node = find_node(error->children, "title"); - if (node && (tmp = xmlNodeGetContent(node))) { - e->title = g_strdup(tmp); - xmlFree(tmp); - } - for (scan = error->children;scan;scan=scan->next) { - if (!strcmp(scan->name, "button")) { + if (!strcmp(scan->name, "primary")) { + if ((tmp = xmlNodeGetContent(scan))) { + e->primary = g_strdup(_(tmp)); + xmlFree(tmp); + } + } else if (!strcmp(scan->name, "secondary")) { + if ((tmp = xmlNodeGetContent(node))) { + e->secondary = g_strdup(_(tmp)); + xmlFree(tmp); + } + } else if (!strcmp(scan->name, "title")) { + if ((tmp = xmlNodeGetContent(node))) { + e->title = g_strdup(_(tmp)); + xmlFree(tmp); + } + } else if (!strcmp(scan->name, "button")) { struct _e_error_button *b; b = g_malloc0(sizeof(*b)); diff --git a/widgets/misc/e-system-errors.xml b/widgets/misc/e-system-errors.xml new file mode 100644 index 0000000000..6bef345263 --- /dev/null +++ b/widgets/misc/e-system-errors.xml @@ -0,0 +1,22 @@ + + + + + Overwrite file? + File exists "{0}". + Do you wish to overwrite it? +