summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS7
-rw-r--r--gettext-tools/doc/ChangeLog4
-rw-r--r--gettext-tools/doc/gettext.texi6
-rw-r--r--gettext-tools/src/ChangeLog6
-rw-r--r--gettext-tools/src/x-glade.c43
-rw-r--r--gettext-tools/src/x-glade.h3
-rw-r--r--gettext-tools/tests/ChangeLog5
-rw-r--r--gettext-tools/tests/Makefile.am2
-rwxr-xr-xgettext-tools/tests/xgettext-25202
9 files changed, 272 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index 505d602..ee984e3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+Version 0.12.2 - XXX 2003
+
+* Data formats support:
+
+ - Glade:
+ xgettext now also supports Glade version 2.
+
Version 0.12.1 - May 2003
* Bug fixes.
diff --git a/gettext-tools/doc/ChangeLog b/gettext-tools/doc/ChangeLog
index fa54bd3..d38b7a1 100644
--- a/gettext-tools/doc/ChangeLog
+++ b/gettext-tools/doc/ChangeLog
@@ -1,3 +1,7 @@
+2003-05-24 Bruno Haible <bruno@clisp.org>
+
+ * gettext.texi (Glade): Mention support og Glade 2.
+
2003-05-22 Bruno Haible <bruno@clisp.org>
* gettext-0.12.1 released.
diff --git a/gettext-tools/doc/gettext.texi b/gettext-tools/doc/gettext.texi
index 36d9d38..68ca888 100644
--- a/gettext-tools/doc/gettext.texi
+++ b/gettext-tools/doc/gettext.texi
@@ -8448,13 +8448,13 @@ fpk
@table @asis
@item RPMs
-glade, libglade, xml-i18n-tools
+glade, libglade, glade2, libglade2, intltool
@item File extension
-@code{glade}
+@code{glade}, @code{glade2}
@item Extractor
-@code{xgettext}, @code{libglade-xgettext}
+@code{xgettext}, @code{libglade-xgettext}, @code{xml-i18n-extract}, @code{intltool-extract}
@end table
@c This is the template for new data formats.
diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog
index 804f45f..e4e9ec6 100644
--- a/gettext-tools/src/ChangeLog
+++ b/gettext-tools/src/ChangeLog
@@ -1,3 +1,9 @@
+2003-05-24 Bruno Haible <bruno@clisp.org>
+
+ * x-glade.h (EXTENSIONS_GLADE): Also recognize the .glade2 extension.
+ * x-glade.c (start_element_handler): Also extract strings according to
+ Glade 2 conventions.
+
2003-05-22 Bruno Haible <bruno@clisp.org>
* gettext-0.12.1 released.
diff --git a/gettext-tools/src/x-glade.c b/gettext-tools/src/x-glade.c
index 3ba11cb..92d20c2 100644
--- a/gettext-tools/src/x-glade.c
+++ b/gettext-tools/src/x-glade.c
@@ -1,5 +1,5 @@
/* xgettext glade backend.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003 Free Software Foundation, Inc.
This file was written by Bruno Haible <haible@clisp.cons.org>, 2002.
@@ -232,8 +232,49 @@ start_element_handler (void *userData, const char *name,
stack[stack_depth - 1].extract_string = false;
p = &stack[stack_depth];
+ /* In Glade 1, a few specific elements are translatable. */
p->extract_string =
(find_entry (&keywords, name, strlen (name), &hash_result) == 0);
+ /* In Glade 2, all <property> and <atkproperty> elements are translatable
+ that have the attribute translatable="yes". */
+ if (!p->extract_string
+ && (strcmp (name, "property") == 0 || strcmp (name, "atkproperty") == 0))
+ {
+ bool has_translatable = false;
+ const char **attp = attributes;
+ while (*attp != NULL)
+ {
+ if (strcmp (attp[0], "translatable") == 0)
+ {
+ has_translatable = (strcmp (attp[1], "yes") == 0);
+ break;
+ }
+ attp += 2;
+ }
+ p->extract_string = has_translatable;
+ }
+ if (!p->extract_string
+ && strcmp (name, "atkaction") == 0)
+ {
+ const char **attp = attributes;
+ while (*attp != NULL)
+ {
+ if (strcmp (attp[0], "description") == 0)
+ {
+ if (strcmp (attp[1], "") != 0)
+ {
+ lex_pos_ty pos;
+
+ pos.file_name = logical_file_name;
+ pos.line_number = XML_GetCurrentLineNumber (parser);
+
+ remember_a_message (mlp, xstrdup (attp[1]), &pos);
+ }
+ break;
+ }
+ attp += 2;
+ }
+ }
p->lineno = XML_GetCurrentLineNumber (parser);
p->buffer = NULL;
p->bufmax = 0;
diff --git a/gettext-tools/src/x-glade.h b/gettext-tools/src/x-glade.h
index db6ae6f..0e750ff 100644
--- a/gettext-tools/src/x-glade.h
+++ b/gettext-tools/src/x-glade.h
@@ -1,5 +1,5 @@
/* xgettext glade backend.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2002.
This program is free software; you can redistribute it and/or modify
@@ -19,6 +19,7 @@
#define EXTENSIONS_GLADE \
{ "glade", "glade" }, \
+ { "glade2", "glade" }, \
#define SCANNERS_GLADE \
{ "glade", extract_glade, NULL }, \
diff --git a/gettext-tools/tests/ChangeLog b/gettext-tools/tests/ChangeLog
index 7c663f3..77aaed6 100644
--- a/gettext-tools/tests/ChangeLog
+++ b/gettext-tools/tests/ChangeLog
@@ -1,3 +1,8 @@
+2003-05-24 Bruno Haible <bruno@clisp.org>
+
+ * xgettext-25: New file.
+ * Makefile.am (TESTS): Add it.
+
2003-05-22 Bruno Haible <bruno@clisp.org>
* gettext-0.12.1 released.
diff --git a/gettext-tools/tests/Makefile.am b/gettext-tools/tests/Makefile.am
index 01887a2..6026993 100644
--- a/gettext-tools/tests/Makefile.am
+++ b/gettext-tools/tests/Makefile.am
@@ -49,7 +49,7 @@ TESTS = gettext-1 gettext-2 \
xgettext-7 xgettext-8 xgettext-9 xgettext-10 xgettext-11 xgettext-12 \
xgettext-13 xgettext-14 xgettext-15 xgettext-16 xgettext-17 \
xgettext-18 xgettext-19 xgettext-20 xgettext-21 xgettext-22 \
- xgettext-23 xgettext-24 \
+ xgettext-23 xgettext-24 xgettext-25 \
format-awk-1 format-awk-2 \
format-c-1 format-c-2 format-c-3 format-c-4 \
format-elisp-1 format-elisp-2 \
diff --git a/gettext-tools/tests/xgettext-25 b/gettext-tools/tests/xgettext-25
new file mode 100755
index 0000000..abc096e
--- /dev/null
+++ b/gettext-tools/tests/xgettext-25
@@ -0,0 +1,202 @@
+#!/bin/sh
+
+# Test of Glade 2 support.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles asciitable.glade2"
+cat <<EOF > asciitable.glade2
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd" >
+
+<glade-interface>
+ <widget class="GtkDialog" id="dialog">
+ <property name="visible">no</property>
+ <property name="title" translatable="yes">gedit: ASCII table</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="modal">no</property>
+ <property name="allow_shrink">yes</property>
+ <property name="allow_grow">yes</property>
+ <property name="window-position">GTK_WIN_POS_NONE</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox1">
+ <property name="homogeneous">no</property>
+ <property name="spacing">8</property>
+ <property name="visible">yes</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <property name="spacing">8</property>
+ <property name="visible">yes</property>
+
+ <child>
+ <widget class="GtkButton" id="insert_char_button">
+ <property name="can_default">yes</property>
+ <property name="can_focus">yes</property>
+ <property name="label" translatable="yes">Insert char</property>
+ <property name="visible">yes</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="close_button">
+ <property name="can_default">yes</property>
+ <property name="can_focus">yes</property>
+ <property name="visible">yes</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">yes</property>
+ <property name="use_underline">yes</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="help_button">
+ <property name="can_default">yes</property>
+ <property name="can_focus">yes</property>
+ <property name="visible">yes</property>
+ <property name="label">gtk-help</property>
+ <property name="use_stock">yes</property>
+ <property name="use_underline">yes</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">no</property>
+ <property name="fill">yes</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="asciitable_dialog_content">
+ <property name="border_width">6</property>
+ <property name="homogeneous">no</property>
+ <property name="spacing">8</property>
+ <property name="visible">yes</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="label" translatable="yes">If you wish to insert any of the characters in to the active
+document, select the character and click the &quot;Insert Char&quot;
+button or double click the character in the table.</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">no</property>
+ <property name="xalign">0.0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="visible">yes</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">no</property>
+ <property name="fill">no</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="height-request">350</property>
+ <property name="visible">yes</property>
+
+ <child>
+ <widget class="GtkTreeView" id="ascii_table">
+ <property name="can_focus">yes</property>
+ <property name="headers-visible">yes</property>
+ <property name="visible">yes</property>
+ </widget>
+ </child>
+
+ <child internal-child="hscrollbar">
+ <widget class="GtkHScrollbar" id="convertwidget1">
+ <property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
+ <property name="visible">yes</property>
+ </widget>
+ </child>
+
+ <child internal-child="vscrollbar">
+ <widget class="GtkVScrollbar" id="convertwidget2">
+ <property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
+ <property name="visible">yes</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">yes</property>
+ <property name="fill">yes</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">yes</property>
+ <property name="fill">yes</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">4</property>
+ <property name="expand">yes</property>
+ <property name="fill">yes</property>
+ </packing>
+ </child>
+ </widget>
+</glade-interface>
+EOF
+
+tmpfiles="$tmpfiles xg-test25.tmp xg-test25.pot"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} -o xg-test25.tmp asciitable.glade2
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+grep -v 'POT-Creation-Date' < xg-test25.tmp > xg-test25.pot
+
+tmpfiles="$tmpfiles xg-test25.ok"
+cat <<EOF > xg-test25.ok
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: asciitable.glade2:7
+msgid "gedit: ASCII table"
+msgstr ""
+
+#: asciitable.glade2:30
+msgid "Insert char"
+msgstr ""
+
+#: asciitable.glade2:74
+msgid ""
+"If you wish to insert any of the characters in to the active \n"
+"document, select the character and click the \"Insert Char\" \n"
+"button or double click the character in the table."
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-test25.ok xg-test25.pot
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result