mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-07-28 13:09:24 +00:00
Changes to make translation building work better.
This commit is contained in:
parent
d5af3a957b
commit
f99588f969
@ -48,17 +48,18 @@ sub extract {
|
||||
# in single or double quotes including concatenated strings like 'one' . "two"
|
||||
while ($data =~
|
||||
/(translate|i18n)\(\s*(((\s*\.\s*)?('((\\')?[^']*)*[^\\]'|"((\\")?[^"]*)*[^\\]"))+)\s*\)/sg) {
|
||||
# Call out to php to parse string..
|
||||
my ($in, $out);
|
||||
open2($in, $out, 'php -q');
|
||||
print $out '<?php print ';
|
||||
print $out $2;
|
||||
print $out ' ?>';
|
||||
close $out;
|
||||
my $text = join('', <$in>);
|
||||
close $in;
|
||||
$text =~ s/\"/\\\"/sg; # escape double-quotes
|
||||
$strings{qq{gettext("$text")}}++;
|
||||
# Call out to php to parse string..
|
||||
my ($in, $out);
|
||||
open2($in, $out, 'php -q');
|
||||
print $out '<?php print ';
|
||||
print $out $2;
|
||||
print $out ' ?>';
|
||||
close $out;
|
||||
my $text = join('', <$in>);
|
||||
close $in;
|
||||
next if ( $text eq "" );
|
||||
$text =~ s/\"/\\\"/sg; # escape double-quotes
|
||||
$strings{qq{gettext("$text")}}++;
|
||||
}
|
||||
|
||||
# grab phrases of this format: translate(array('one' => '...', 'many' => '...'))
|
||||
@ -72,6 +73,7 @@ sub extract {
|
||||
# grab phrases of this format: translate(array('text' => '...', ...))
|
||||
while ($data =~ /translate\(\s*array\('text'\s*=>\s+'(.*?[^\\])'/sg) {
|
||||
my $text = $1;
|
||||
next if ( $text eq "" );
|
||||
$text =~ s/\"/\\\"/sg; # escape double-quotes
|
||||
$strings{qq{gettext("$text")}}++;
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ PODIR="po"
|
||||
LOCALEDIR="locale"
|
||||
APPLICATION="rscds"
|
||||
|
||||
${POTOOLS}/extract.pl htdocs inc > ${PODIR}/strings.raw
|
||||
${POTOOLS}/extract.pl htdocs inc ../awl/inc > ${PODIR}/strings.raw
|
||||
xgettext --keyword=_ -C --no-location --output=${PODIR}/messages.tmp ${PODIR}/strings.raw
|
||||
sed -e 's/CHARSET/UTF-8/' <${PODIR}/messages.tmp >${PODIR}/messages.po
|
||||
rm ${PODIR}/messages.tmp
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user