summaryrefslogtreecommitdiffstats
path: root/po/bin/add_text
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2007-06-07 18:54:11 +0000
committerThierry Vignaud <tv@mandriva.org>2007-06-07 18:54:11 +0000
commit534f2f4437093bd78411126ef45de41fc6b93bf3 (patch)
tree1a9c1e259e6f2495ebcacf3cbd8cb7d3fdaaac2a /po/bin/add_text
parent92072c3be58f5c77ff0fecdaf6617fe6fa4120e1 (diff)
downloadbootloader-theme-534f2f4437093bd78411126ef45de41fc6b93bf3.tar
bootloader-theme-534f2f4437093bd78411126ef45de41fc6b93bf3.tar.gz
bootloader-theme-534f2f4437093bd78411126ef45de41fc6b93bf3.tar.bz2
bootloader-theme-534f2f4437093bd78411126ef45de41fc6b93bf3.tar.xz
bootloader-theme-534f2f4437093bd78411126ef45de41fc6b93bf3.zip
reimport my latest checkout
Diffstat (limited to 'po/bin/add_text')
-rwxr-xr-xpo/bin/add_text56
1 files changed, 56 insertions, 0 deletions
diff --git a/po/bin/add_text b/po/bin/add_text
new file mode 100755
index 0000000..a725b46
--- /dev/null
+++ b/po/bin/add_text
@@ -0,0 +1,56 @@
+#! /usr/bin/perl
+
+# add a new text to *.po files
+
+die "usage: add_text [-c comment] id text_line1 text_line2 ... \nexample:\n add_text MENU_LANG Language\n" if @ARGV < 2;
+
+if($ARGV[0] eq '-c') {
+ shift;
+ $comment = shift;
+}
+
+$id = shift;
+@texts = @ARGV;
+
+$id =~ s/^txt_//;
+
+$_ = join '', @texts;
+
+push @l, "# $comment\n" if $comment;
+push @l, "#. txt_$id\n";
+push @l, "#, c-format\n" if /%/;
+
+if(@texts == 1) {
+ push @l, "msgid \"$texts[0]\"\n"
+}
+else {
+ push @l, "msgid \"\"\n";
+ for (@texts) { push @l, "\"$_\"\n" }
+}
+
+push @l, "msgstr \"\"\n";
+push @l, "\n";
+
+print @l;
+
+print STDERR "Should this entry be added to all *.po files? [Y/n]\n";
+
+$_ = <STDIN>;
+
+chomp;
+
+$_ = "\L$_";
+
+exit unless $_ eq '' || $_ eq 'y';
+
+print "ok\n";
+
+for $f ("bootloader.pot", <*.po>) {
+ if(open F, "+<$f") {
+ @f = <F>;
+ print F "\n" if $f[-1] !~ /^\s*$/;
+ print F @l;
+ close F;
+ }
+}
+