Skip to content

Commit f57f76e

Browse files
committed
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.
1 parent 8ddd75f commit f57f76e

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

Messages.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ ACTIONFILES=`find . -name \*.action`
1414
./action_i18n.pl --context=action $ACTIONFILES >> rc.cpp
1515

1616
# extracti18n.pl extracts additional data from brushes, palettes etc.
17-
perl extracti18n.pl > i18ndata
17+
perl extracti18n.pl >> rc.cpp
1818

1919
# Ignore sdk/templates which contains templates for writing future plugins.
2020
# Also ignore crashreporter, it has it's own catalog
2121
# None of the placeholder strings inside will be seen by users.
22-
kundo2_aware_xgettext krita.pot i18ndata rc.cpp \
22+
kundo2_aware_xgettext krita.pot rc.cpp \
2323
`find . -name \*.cc -o -name \*.h -o -name \*.cpp | \
2424
grep -v '/tests/' | grep -v './sdk/templates' | grep -v './krita/crashreporter/'`
2525

2626
# Extract the messages in Python plugins.
2727
$XGETTEXT -L Python `find . -name \*.py` -j -o $podir/krita.pot
2828

2929
# Clean up
30-
rm -f i18ndata rc.cpp
30+
rm -f rc.cpp

extracti18n.pl

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@
2222
use strict;
2323
use warnings;
2424

25-
sub printi18n($$) {
25+
sub printi18n($$$$) {
2626
if ($_[0] ne "")
2727
{
28+
if ($_[3] > 0)
29+
{
30+
print "// i18n: file: ".$_[2].":".$_[3]."\n";
31+
}
2832
print "i18nc(\"".$_[1]."\",\"".$_[0]."\");\n";
2933
}
3034
}
@@ -49,13 +53,13 @@ ($$)
4953
my @splited = split(/: /, $lines[1]);
5054
my $name = $splited[1];
5155
chomp($name);
52-
printi18n($name, $filename);
56+
printi18n($name, $filename, $filename, 2);
5357
}
5458
else
5559
{
5660
my $name = $lines[0];
5761
chomp($name);
58-
printi18n($name, $filename);
62+
printi18n($name, $filename, $filename, 1);
5963
}
6064
}
6165
else
@@ -70,13 +74,13 @@ ($$)
7074
{
7175
read(FILE, $bytes, 12);
7276
read(FILE, my $name, $size - 21);
73-
printi18n($name, $filename);
77+
printi18n($name, $filename, $filename, -1);
7478
}
7579
else
7680
{
7781
read(FILE, $bytes, 20);
7882
read(FILE, my $name, $size - 29);
79-
printi18n($name, $filename);
83+
printi18n($name, $filename, $filename, -1);
8084
}
8185
}
8286
else
@@ -85,7 +89,7 @@ ($$)
8589
my $size = unpack("N", $bytes);
8690
read(FILE, $bytes, 20);
8791
read(FILE, my $name, $size - 25);
88-
printi18n($name, $filename);
92+
printi18n($name, $filename, $filename, -1);
8993
}
9094
}
9195
}

0 commit comments

Comments
 (0)