| 1 | #!/usr/bin/perl -w
|
|---|
| 2 | # vi:wrap:
|
|---|
| 3 |
|
|---|
| 4 | # See Qt I18N documentation for usage information.
|
|---|
| 5 |
|
|---|
| 6 | use POSIX qw(strftime);
|
|---|
| 7 |
|
|---|
| 8 | $projectid='PROJECT VERSION';
|
|---|
| 9 | $datetime = strftime "%Y-%m-%d %X %Z", localtime;
|
|---|
| 10 | $charset='iso-8859-1';
|
|---|
| 11 | $translator='FULLNAME <EMAIL@ADDRESS>';
|
|---|
| 12 | $revision_date='YYYY-MM-DD';
|
|---|
| 13 |
|
|---|
| 14 | $real_mark = "tr";
|
|---|
| 15 | $noop_mark = "QT_TR_NOOP";
|
|---|
| 16 | $scoped_mark = "qApp->translate";
|
|---|
| 17 | $noop_scoped_mark = "QT_TRANSLATE_NOOP";
|
|---|
| 18 |
|
|---|
| 19 | $header=
|
|---|
| 20 | '# This is a Qt message file in .po format. Each msgid starts with
|
|---|
| 21 | # a scope. This scope should *NOT* be translated - eg. translating
|
|---|
| 22 | # from French to English, "Foo::Bar" would be translated to "Pub",
|
|---|
| 23 | # not "Foo::Pub".
|
|---|
| 24 | msgid ""
|
|---|
| 25 | msgstr ""
|
|---|
| 26 | "Project-Id-Version: '.$projectid.'\n"
|
|---|
| 27 | "POT-Creation-Date: '.$datetime.'\n"
|
|---|
| 28 | "PO-Revision-Date: '.$revision_date.'\n"
|
|---|
| 29 | "Last-Translator: '.$translator.'\n"
|
|---|
| 30 | "Content-Type: text/plain; charset='.$charset.'\n"
|
|---|
| 31 |
|
|---|
| 32 | ';
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 | $scope = "";
|
|---|
| 38 |
|
|---|
| 39 | if ( $#ARGV < 0 ) {
|
|---|
| 40 | print STDERR "Usage: findtr sourcefile ... >project.po\n";
|
|---|
| 41 | exit 1;
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 | sub outmsg {
|
|---|
| 46 | my ($file, $line, $scope, $msgid) = @_;
|
|---|
| 47 | # unesc
|
|---|
| 48 | $msgid =~ s/$esc:$esc:$esc/::/gs;
|
|---|
| 49 | $msgid =~ s|$esc/$esc/$esc|//|gs;
|
|---|
| 50 |
|
|---|
| 51 | # Remove blank lines
|
|---|
| 52 | $msgid =~ s/\n\n+/\n/gs;
|
|---|
| 53 | $msgid = "\"\"\n$msgid" if $msgid =~ /\n/s;
|
|---|
| 54 | print "#: $file:$line\n";
|
|---|
| 55 | $msgid =~ s/^"//; #"emacs bug
|
|---|
| 56 | print "msgid \"${scope}::$msgid\n";
|
|---|
| 57 | #print "msgstr \"$msgid\n";
|
|---|
| 58 | print "msgstr \"\"\n";
|
|---|
|
|---|