summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bruce Park <robert.park@canonical.com>2012-08-22 22:39:02 -0500
committerRobert Bruce Park <robert.park@canonical.com>2012-08-22 22:39:02 -0500
commit2d62c74c4f54a75c1070905e6346b4e0e17f246d (patch)
tree4012b154a6e95fcc51660cee80c633404a80f4aa
parentc508b32832bb8939f3bb274c7eb0af04a18ba5dd (diff)
downloadintltool-2d62c74c4f54a75c1070905e6346b4e0e17f246d.tar.gz
Add test case for single quotes, and fix the bug that I discovered
as a result of adding this test.
-rw-r--r--intltool-extract.in2
-rw-r--r--tests/cases/extract-gtkbuilder-single.ui29
-rw-r--r--tests/results/extract-gtkbuilder-single.ui.h3
-rwxr-xr-xtests/selftest.pl.in6
4 files changed, 39 insertions, 1 deletions
diff --git a/intltool-extract.in b/intltool-extract.in
index 60dea88..6e9c3cf 100644
--- a/intltool-extract.in
+++ b/intltool-extract.in
@@ -847,7 +847,7 @@ sub type_glade {
}
## handle new glade files
- while ($input =~ /<(\w+)\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/extract-gtkbuilder-single.ui b/tests/cases/extract-gtkbuilder-single.ui
new file mode 100644
index 0000000..926bb67
--- /dev/null
+++ b/tests/cases/extract-gtkbuilder-single.ui
@@ -0,0 +1,29 @@
+<interface>
+ <object class='GtkDialog' id='dialog1'>
+ <child internal-child='vbox'>
+ <object class='GtkVBox' id='vbox1'>
+ <property name='border-width'>10</property>
+ <child internal-child='action_area'>
+ <object class='GtkHBox' id='hbox1'>
+ <property name='border-width'>20</property>
+ <child>
+ <object class='GtkLabel' id='help'>
+ <property name='label' translatable='yes'>help</property>
+ </object>
+ </child>
+ <child>
+ <object class='GtkLabel' id='user-help'>
+ <property name='label' translatable='yes' context='user'>help</property>
+ </object>
+ </child>
+ <child>
+ <object class='GtkLabel' id='developer-help'>
+ <property name='label' translatable='yes' context='developer'>help</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/tests/results/extract-gtkbuilder-single.ui.h b/tests/results/extract-gtkbuilder-single.ui.h
new file mode 100644
index 0000000..da417c8
--- /dev/null
+++ b/tests/results/extract-gtkbuilder-single.ui.h
@@ -0,0 +1,3 @@
+char *s = N_("help");
+char *s = C_("user", "help");
+char *s = C_("developer", "help");
diff --git a/tests/selftest.pl.in b/tests/selftest.pl.in
index e27d965..8746f9b 100755
--- a/tests/selftest.pl.in
+++ b/tests/selftest.pl.in
@@ -289,6 +289,12 @@ $case = "gsettings.gschema.xml";
system("$INTLTOOL_EXTRACT --type=gettext/gsettings --quiet --update cases/$case") == 0 or $failed = 1;
check_extract_result($case);
+print "39. Allow single quotes, like translatable='yes': ";
+$case = "extract-gtkbuilder-single.ui";
+system("$INTLTOOL_EXTRACT --type=gettext/glade --quiet --update cases/$case") == 0 or $failed = 1;
+check_extract_result($case);
+
+
system("rm -f cases/*.*") if $srcdir ne ".";
system("rm -rf C az extract9 fr fr_BE fr_FR merge6 schemasmerge1 schemasmerge2 spacepreserve test test-quoted merge6.xml");