Pulling translation from Pootle for local build

I’m trying to test the latest Arabic translation on a local build from
source, it is enough to download the PO files from Pootle and extract
them to the translation/source/ar/, or are there any post-processing
steps needed? I just did that and I see lots of comments like “#. eDUKr”
in the files I got from Pootle, not sure of they are harmless.

Regards,
Khaled

Hi Khaled,

Those comments are harmless. We clean them before commit/push (to reduce
file size?). There is no need to post-process po files before build.

Best regards,
Andras

Thanks Andras, much appreciated.

Is there a shortcut to just rebuild the translation? I tried using
make build-l10n-only but it seems to cause lots of translation not to
show up.

Regards,
Khaled

Actually it seems to be a problem with the files I downloaded from
Pootle, if I revert them and do make build-l10n-only the old
translations show back fully.

Regards,
Khaled

Hi *,

I’m trying to test the latest Arabic translation on a local build from
source, it is enough to download the PO files from Pootle and extract
them to the translation/source/ar/

For UI only yes, help needs a little reshuffling (move into the proper
directory) - also for languages using underscore as delimiter in
pootle, need to rename the directory to use dash instead.

, or are there any post-processing
steps needed?

RE does processing to reduce noise in the diff, most notably removing
the key-ID identifier and getting rid of obsolete strings (but those
aren't exported when using webexport anyway), and using msguniq
--no-wrap to have strings in a single line (if not a block to begin
with)

I just did that and I see lots of comments like “#. eDUKr”
in the files I got from Pootle, not sure of they are harmless.

Should be harmless.

In case you're interested: this is the cleanup RE runs (apart from
also running it with pocheck afterwards)

#!/bin/bash
# run with:
# find $lo_lang_temp/translations/libo*_ui/ -name *.po -print0 | xargs
-r -0 -P4 -I pofile $lo_repos/translation_templated/convertme.sh
pofile

pofile=$1
echo processing $pofile
sed -e '/^#~/d' -e '/^#\. .....\?$/d' -e 's/^#\. ...#:/#:/' -e
'/^#$/d' -e '/^#[^:~,.]/d' $pofile > $pofile.new && msguniq --no-wrap
$pofile.new | sed 's/[ ]*$//' > $pofile && rm -f $pofile.new

So if you want to reduce noise between your changes and what's in the
repo, run the above, and also pocheck:
LD_LIBRARY_PATH=instdir/program make cmd
cmd=workdir/LinkTarget/Executable/pocheck 2>&1 |tee ~/tmp/pocheck.log

Files will still have metadata changes (like the export-date), we
filter those out with:
# add files with actual changes
for file in $(LC_MESSAGES=C git status |awk '/modified/{print $2}' ) ;
do if (git diff -- $file |egrep -m 2 '^[+-](msg(id|str) "[^"]|#,
fuzzy)') ; then git add $file; fi; done
#commit/review those...
# files with possible matches
for file in $(LC_MESSAGES=C git status |awk '/modified/{print $2}' ) ;
do if (git diff -- $file | grep ^[+-][^+-] |grep -v -e
"POT-Creation-Date" -e "X-Generator" -e "X-POOTLE-MTIME" -e "#.
extracted from" -e "PO-Revision-Date:" -e "Last-Translator" -e
'^[+-]"Language: ' -e '^[+-]"Language-Team: ' -e
"Report-Msgid-Bugs-To: " -e "X-Accelerator-Marker: " -e
"Project-Id-Version:" -e "Plural-Forms: " -e "Content-Type:
text/plain; charset=") ; then git add $file; fi; done
# review and commit--amend

# check that nothing was missed
LC_MESSAGES=C git status |awk '/modified/{print $2}' | xargs -r git
diff |grep ^[+-][^+-] |grep -v -e X-POOTLE-MTIME -e "#. extracted from
" -e POT-Creation-Date: -e PO-Revision-Date -e X-Accelerator-Marker -e
X-Generator -e Last-Translator -e '^[+-]"Language: ' -e
'^[+-]"Language-Team: ' -e "Plural-Forms: " -e Report-Msgid-Bugs-To |
sort -u
# if not, clear list - might have to run this multiple times in case
git stubmles over its own lock
LC_MESSAGES=C git status |awk '/modified/{print $2}' | xargs -r git checkout --

beware of linebreaks in all of the commands, the commands themselves
all on one line...
Note that for viewing diff in the repo itself, when using "git diff"
- you could setup a textconv filter that does something similar to the
above, i.e. ignoring all the metadata-headers that don't reflect
actual string change)

sample I have in my local pot repo to do some sanity checking (in
~/.git/config, adapting to po case is left as exercise for the reader
:-P):
[diff "potfile"]
        textconv = "sed -e '/POT-Creation-Date/d'"

and corresponding entry in ~/.gitattributes:
*.pot diff=potfile

ciao
Christian