summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2012-01-30 12:32:21 -0500
committerRyan Lortie <desrt@desrt.ca>2012-01-30 12:32:21 -0500
commit2aaa95f609b5936f82f8281bf2f850a3e14eae2d (patch)
treea1b70e309e53245d9062057594694cc852c753a3
parentf723f40a9513a1baa922d96ddd0ac038c09f205b (diff)
downloadintltool-2aaa95f609b5936f82f8281bf2f850a3e14eae2d.tar.gz
Bug #923841: support menus in glade files
Instead of hardcoding a list (property, atkproperty, col) of tags that we support translatable="yes" on, support it on all tags. This lets us pick up <attribute translatable="yes"> as is used within <menu> of a GtkBuilder file.
-rw-r--r--intltool-extract.in2
-rw-r--r--tests/cases/extract8.glade14
-rw-r--r--tests/results/extract8.glade.h3
3 files changed, 18 insertions, 1 deletions
diff --git a/intltool-extract.in b/intltool-extract.in
index c48a9ec..eb6956d 100644
--- a/intltool-extract.in
+++ b/intltool-extract.in
@@ -847,7 +847,7 @@ sub type_glade {
}
## handle new glade files
- while ($input =~ /<(property|atkproperty|col)\s+[^>]*translatable\s*=\s*"yes"(?:\s+[^>]*context\s*=\s*"([^"]*)")?(?:\s+[^>]*comments\s*=\s*"([^"]*)")?[^>]*>([^<]+)<\/\1>/sg) {
+ while ($input =~ /<(\w+)\s+[^>]*translatable\s*=\s*"yes"(?:\s+[^>]*context\s*=\s*"([^"]*)")?(?:\s+[^>]*comments\s*=\s*"([^"]*)")?[^>]*>([^<]+)<\/\1>/sg) {
if (!($4 =~ /^(window|label)[0-9]+$/)) {
my $message = entity_decode($4);
if (defined($2)) {
diff --git a/tests/cases/extract8.glade b/tests/cases/extract8.glade
index cf5188c..fc37b1c 100644
--- a/tests/cases/extract8.glade
+++ b/tests/cases/extract8.glade
@@ -2,6 +2,20 @@
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd" >
<glade-interface>
+ <menu id='app-menu'>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_New Window</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_New Tab</attribute>
+ </item>
+ </section>
+ <section>
+ <attribute name="label" translatable="yes">_Quit</attribute>
+ </section>
+ </menu>
+
<widget class="GtkWindow" id="window1">
<property name="title" translatable="yes">Testing</property>
<property name="border_width">10</property>
diff --git a/tests/results/extract8.glade.h b/tests/results/extract8.glade.h
index fd82e2a..f5d13a8 100644
--- a/tests/results/extract8.glade.h
+++ b/tests/results/extract8.glade.h
@@ -1,3 +1,6 @@
+char *s = N_("_New Window");
+char *s = N_("_New Tab");
+char *s = N_("_Quit");
char *s = N_("Testing");
/* Comment on <property> tag */
char *s = N_("A label");