diff options
author | Not Zed <NotZed@Ximian.com> | 2004-05-12 11:36:37 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-05-12 11:36:37 +0800 |
commit | 72dbc81f48008909473e67eb23e61e05ff4d8057 (patch) | |
tree | 7ae2ce7aabf1c82da3ff9f8de2284966f9edb6e0 /widgets/misc | |
parent | 97926d706a599a789b8d7b03a9e41a20513659d1 (diff) | |
download | gsoc2013-evolution-72dbc81f48008909473e67eb23e61e05ff4d8057.tar.gz gsoc2013-evolution-72dbc81f48008909473e67eb23e61e05ff4d8057.tar.zst gsoc2013-evolution-72dbc81f48008909473e67eb23e61e05ff4d8057.zip |
make the Because cases the same.
2004-05-12 Not Zed <NotZed@Ximian.com>
* 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
Diffstat (limited to 'widgets/misc')
-rw-r--r-- | widgets/misc/ChangeLog | 16 | ||||
-rw-r--r-- | widgets/misc/Makefile.am | 12 | ||||
-rw-r--r-- | widgets/misc/e-error.c | 73 | ||||
-rw-r--r-- | widgets/misc/e-system-errors.xml | 22 | ||||
-rw-r--r-- | widgets/misc/e-system-errors.xml.h | 15 | ||||
-rw-r--r-- | widgets/misc/e-system-errors.xml.in | 22 |
6 files changed, 76 insertions, 84 deletions
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 <NotZed@Ximian.com> + + * 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 <xan@gnome.org> * 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 @@ +<?xml version="1.0"?> +<error-list domain="system"> + + <error id="ask-save-file-exists-overwrite" type="error" default="GTK_RESPONSE_CANCEL"> + <title>Overwrite file?</title> + <primary>File exists "{0}".</primary> + <secondary>Do you wish to overwrite it?</secondary> + <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/> + <button label="_Overwrite" response="GTK_RESPONSE_OK"/> + </error> + + <error id="no-save-file" type="error"> + <primary>Cannot save file "{0}".</primary> + <secondary>Because "{1}".</secondary> + </error> + + <error id="no-load-file" type="error"> + <primary>Cannot open file "{0}".</primary> + <secondary>Because "{1}".</secondary> + </error> + +</error-list> diff --git a/widgets/misc/e-system-errors.xml.h b/widgets/misc/e-system-errors.xml.h new file mode 100644 index 0000000000..16f0891e9f --- /dev/null +++ b/widgets/misc/e-system-errors.xml.h @@ -0,0 +1,15 @@ +/* system:ask-save-file-exists-overwrite title */ +char *s = N_("Overwrite file?"); +/* system:ask-save-file-exists-overwrite primary */ +char *s = N_("File exists \"{0}\"."); +/* system:ask-save-file-exists-overwrite secondary */ +char *s = N_("Do you wish to overwrite it?"); +char *s = N_("_Overwrite"); +/* system:no-save-file primary */ +char *s = N_("Cannot save file \"{0}\"."); +/* system:no-save-file secondary */ +char *s = N_("Because \"{1}\"."); +/* system:no-load-file primary */ +char *s = N_("Cannot open file \"{0}\"."); +/* system:no-load-file secondary */ +char *s = N_("Because \"{1}\"."); diff --git a/widgets/misc/e-system-errors.xml.in b/widgets/misc/e-system-errors.xml.in deleted file mode 100644 index 00175f91f1..0000000000 --- a/widgets/misc/e-system-errors.xml.in +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0"?> -<error-list domain="system"> - - <error id="ask-save-file-exists-overwrite" type="error" default="GTK_RESPONSE_CANCEL"> - <_title>Overwrite file?</_title> - <_primary>File exists "{0}".</_primary> - <_secondary>Do you wish to overwrite it?</_secondary> - <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/> - <button _label="_Overwrite" response="GTK_RESPONSE_OK"/> - </error> - - <error id="no-save-file" type="error"> - <_primary>Cannot save file "{0}".</_primary> - <_secondary>Because "{1}"</_secondary> - </error> - - <error id="no-load-file" type="error"> - <_primary>Cannot open file "{0}".</_primary> - <_secondary>Because "{1}".</_secondary> - </error> - -</error-list> |