You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gfxboot-theme-calculate/po/bin/add_text

55 lines
835 B

#! /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, "\n";
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";
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") {
print F @l;
close F;
}
}