Commit f57f76e6 authored by Pino Toscano's avatar Pino Toscano

i18n: use location for strings of palettes/brushes/etc

If known, output the location of the strings as comment; together with
the usage of rc.cpp (instead of i18ndata) as temporary file for these
strings, this makes sure the .po file shows their locations.
parent 8ddd75fd
...@@ -14,12 +14,12 @@ ACTIONFILES=`find . -name \*.action` ...@@ -14,12 +14,12 @@ ACTIONFILES=`find . -name \*.action`
./action_i18n.pl --context=action $ACTIONFILES >> rc.cpp ./action_i18n.pl --context=action $ACTIONFILES >> rc.cpp
# extracti18n.pl extracts additional data from brushes, palettes etc. # extracti18n.pl extracts additional data from brushes, palettes etc.
perl extracti18n.pl > i18ndata perl extracti18n.pl >> rc.cpp
# Ignore sdk/templates which contains templates for writing future plugins. # Ignore sdk/templates which contains templates for writing future plugins.
# Also ignore crashreporter, it has it's own catalog # Also ignore crashreporter, it has it's own catalog
# None of the placeholder strings inside will be seen by users. # None of the placeholder strings inside will be seen by users.
kundo2_aware_xgettext krita.pot i18ndata rc.cpp \ kundo2_aware_xgettext krita.pot rc.cpp \
`find . -name \*.cc -o -name \*.h -o -name \*.cpp | \ `find . -name \*.cc -o -name \*.h -o -name \*.cpp | \
grep -v '/tests/' | grep -v './sdk/templates' | grep -v './krita/crashreporter/'` grep -v '/tests/' | grep -v './sdk/templates' | grep -v './krita/crashreporter/'`
...@@ -27,4 +27,4 @@ kundo2_aware_xgettext krita.pot i18ndata rc.cpp \ ...@@ -27,4 +27,4 @@ kundo2_aware_xgettext krita.pot i18ndata rc.cpp \
$XGETTEXT -L Python `find . -name \*.py` -j -o $podir/krita.pot $XGETTEXT -L Python `find . -name \*.py` -j -o $podir/krita.pot
# Clean up # Clean up
rm -f i18ndata rc.cpp rm -f rc.cpp
...@@ -22,9 +22,13 @@ ...@@ -22,9 +22,13 @@
use strict; use strict;
use warnings; use warnings;
sub printi18n($$) { sub printi18n($$$$) {
if ($_[0] ne "") if ($_[0] ne "")
{ {
if ($_[3] > 0)
{
print "// i18n: file: ".$_[2].":".$_[3]."\n";
}
print "i18nc(\"".$_[1]."\",\"".$_[0]."\");\n"; print "i18nc(\"".$_[1]."\",\"".$_[0]."\");\n";
} }
} }
...@@ -49,13 +53,13 @@ foreach my $filename (@filenames) ...@@ -49,13 +53,13 @@ foreach my $filename (@filenames)
my @splited = split(/: /, $lines[1]); my @splited = split(/: /, $lines[1]);
my $name = $splited[1]; my $name = $splited[1];
chomp($name); chomp($name);
printi18n($name, $filename); printi18n($name, $filename, $filename, 2);
} }
else else
{ {
my $name = $lines[0]; my $name = $lines[0];
chomp($name); chomp($name);
printi18n($name, $filename); printi18n($name, $filename, $filename, 1);
} }
} }
else else
...@@ -70,13 +74,13 @@ foreach my $filename (@filenames) ...@@ -70,13 +74,13 @@ foreach my $filename (@filenames)
{ {
read(FILE, $bytes, 12); read(FILE, $bytes, 12);
read(FILE, my $name, $size - 21); read(FILE, my $name, $size - 21);
printi18n($name, $filename); printi18n($name, $filename, $filename, -1);
} }
else else
{ {
read(FILE, $bytes, 20); read(FILE, $bytes, 20);
read(FILE, my $name, $size - 29); read(FILE, my $name, $size - 29);
printi18n($name, $filename); printi18n($name, $filename, $filename, -1);
} }
} }
else else
...@@ -85,7 +89,7 @@ foreach my $filename (@filenames) ...@@ -85,7 +89,7 @@ foreach my $filename (@filenames)
my $size = unpack("N", $bytes); my $size = unpack("N", $bytes);
read(FILE, $bytes, 20); read(FILE, $bytes, 20);
read(FILE, my $name, $size - 25); read(FILE, my $name, $size - 25);
printi18n($name, $filename); printi18n($name, $filename, $filename, -1);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment