From 34867c4f967a93042e453e550aa5a7921141db7b Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Mon, 23 Jun 2003 03:45:45 +0000 Subject: [PATCH] Renamed files to support gettextizing with intltool. page-sizes.paper -> paper-sizes.xml predefined-labels.template ->predefined-templates.xml xml-paper now looks for files with ".paper" extension or exactly named "paper-sizes.xml". xml-template now looks for files with ".template" extension or ending with "-templates.xml". Gettext is run on attributes starting with "_" in both xml-paper and xml-template. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@263 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- glabels2/src/paper.c | 3 ++- glabels2/src/template.c | 6 ++++-- glabels2/src/xml-paper.c | 10 +++++++++- glabels2/src/xml-template.c | 9 ++++++++- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/glabels2/src/paper.c b/glabels2/src/paper.c index 807ed492..f56c90c5 100644 --- a/glabels2/src/paper.c +++ b/glabels2/src/paper.c @@ -373,7 +373,8 @@ read_paper_files_from_dir (GList *papers, if (extension != NULL) { - if (strcasecmp (extension, ".paper") == 0) { + if ( (g_strcasecmp (extension, ".paper") == 0) + || (g_strcasecmp (filename, "paper-sizes.xml") == 0) ) { full_filename = g_build_filename (dirname, filename, NULL); diff --git a/glabels2/src/template.c b/glabels2/src/template.c index 36b4f9ba..474762d0 100644 --- a/glabels2/src/template.c +++ b/glabels2/src/template.c @@ -367,7 +367,7 @@ read_template_files_from_dir (GList *templates, const gchar *dirname) { GDir *dp; - const gchar *filename, *extension; + const gchar *filename, *extension, *extension2; gchar *full_filename = NULL; GError *gerror = NULL; @@ -386,10 +386,12 @@ read_template_files_from_dir (GList *templates, while ((filename = g_dir_read_name (dp)) != NULL) { extension = strrchr (filename, '.'); + extension2 = strrchr (filename, '-'); if (extension != NULL) { - if (strcasecmp (extension, ".template") == 0) { + if ( (g_strcasecmp (extension, ".template") == 0) + || (g_strcasecmp (extension2, "-templates.xml") == 0) ) { full_filename = g_build_filename (dirname, filename, NULL); diff --git a/glabels2/src/xml-paper.c b/glabels2/src/xml-paper.c index 41b0dec3..7e5ede49 100644 --- a/glabels2/src/xml-paper.c +++ b/glabels2/src/xml-paper.c @@ -23,6 +23,7 @@ #include #include +#include #include "xml.h" #include "xml-paper.h" @@ -108,13 +109,20 @@ glPaper * gl_xml_paper_parse_paper (xmlNodePtr paper_node) { glPaper *paper; + gchar *name; gl_debug (DEBUG_PAPER, "START"); paper = g_new0 (glPaper, 1); paper->id = xmlGetProp (paper_node, "id"); - paper->name = xmlGetProp (paper_node, "_name"); + + name = xmlGetProp (paper_node, "_name"); + if (name != NULL) { + paper->name = gettext (name); + } else { + paper->name = xmlGetProp (paper_node, "name"); + } paper->width = gl_xml_get_prop_length (paper_node, "width", 0); paper->height = gl_xml_get_prop_length (paper_node, "height", 0); diff --git a/glabels2/src/xml-template.c b/glabels2/src/xml-template.c index 6327e60a..7beda196 100644 --- a/glabels2/src/xml-template.c +++ b/glabels2/src/xml-template.c @@ -23,6 +23,7 @@ #include #include +#include #include "util.h" #include "paper.h" @@ -132,6 +133,7 @@ gl_xml_template_parse_sheet (xmlNodePtr sheet_node) { glTemplate *template; xmlNodePtr node; + gchar *description; glPaper *paper; gl_debug (DEBUG_TEMPLATE, "START"); @@ -159,7 +161,12 @@ gl_xml_template_parse_sheet (xmlNodePtr sheet_node) gl_paper_free (&paper); } - template->description = xmlGetProp (sheet_node, "description"); + description = xmlGetProp (sheet_node, "_description"); + if (description != NULL) { + template->description = gettext (description); + } else { + template->description = xmlGetProp (sheet_node, "description"); + } for (node = sheet_node->xmlChildrenNode; node != NULL; node = node->next) { -- 2.39.5