aboutsummaryrefslogtreecommitdiffstats
path: root/bin/gettext-nget-patch
diff options
context:
space:
mode:
Diffstat (limited to 'bin/gettext-nget-patch')
-rwxr-xr-xbin/gettext-nget-patch30
1 files changed, 30 insertions, 0 deletions
diff --git a/bin/gettext-nget-patch b/bin/gettext-nget-patch
new file mode 100755
index 000000000..8f8dbc346
--- /dev/null
+++ b/bin/gettext-nget-patch
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+#
+# xgettext doesn't deal with TT files, but xgettext.pl doesn't find nget()s, sigh.
+# This will find the nget()s and output a .po file excerpt.
+
+use File::Find qw/find/;
+
+find( sub {
+ next unless -f;
+ open (FP, $_) or die $!;
+ while (<FP>) {
+ next unless /nget/;
+ my $line = $.;
+ my $text = $_;
+ do {
+ $text .= <FP>;
+ } until $text =~ /\)/;
+ $text =~ /nget\(\s*"(.*?)"\s*,\s*"(.*?)"\s*,\s*(.*?)\s*\)/s;
+ print <<EOF;
+
+#: $File::Find::name:$line
+#, perl-format
+msgid "$1"
+msgid_plural "$2"
+msgstr[0] ""
+msgstr[1] ""
+EOF
+ }
+ close FP;
+}, 'templates');