debian-reference/bin/po4a1
Osamu Aoki 5dd8137e4a refactor po build
Drop linenumber for easier merge and diff tracking

This is preparation for 3-way clean merge.

One example of such 3-way merge article is at:
 * https://stackoverflow.com/a/29535676/334451

This install some driver like:

```
 $ git config merge.merge-po-files.driver "./bin/merge-po-files %A %O %B %P"
```
Note that you also need file `.gitattributes` with following lines:
```
[attr]POFILE merge=merge-po-files
locale/*.po POFILE
```
There are other references:
 * https://github.com/mezis/git-whistles/blob/master/libexec/git-merge-po.sh
 * https://stackoverflow.com/questions/16214067/wheres-the-3-way-git-merge-driver-for-po-gettext-files/29535676#29535676
 * https://stackoverflow.com/questions/2006351/gettext-po-files-under-version-control/11291001#11291001
 * https://gist.github.com/SebCorbin/d196a96b1b5f30f3c3947c3d35fe420b

Signed-off-by: Osamu Aoki <osamu@debian.org>
2024-01-26 13:21:26 +09:00

30 lines
1 KiB
Bash
Executable file

#!/bin/sh -e
#
# This is a build script for all *.xml data used by Makefile
# This is smart enough
# * to skip po data for untranslated and
# * to use fall back translation for zh-cn/zh-tw
#
# List of translation languges as arguments
LANGPO="$*"
# Directory holding po data based on debian-reference.en.xmlt (persistent)
DPO="po"
DBIN="bin"
# The threshold should be 80 if translation is completed.
MSGCAT="/usr/bin/msgcat"
# current debian-reference package verison in Debian
DVERSION=`head debian/changelog -n 1 | cut -d "(" -f2 | cut -d ")" -f1`
echo "I: build English source"
make debian-reference.en.xml
echo "I: build English source (less non-translating strings to reduce po size)"
make debian-reference.en.xmlt
# since po/debian-reference.pot is commited to git repo, no need to do this any more.
#touch -t 200001010000.00 po/debian-reference.pot
# set up po4a.cfg for po
sed -e "s/@LANGPO@/${LANGPO}/" -e "s/@DVERSION@/${DVERSION}/" po4a.cfg.in > po4a.cfg
echo "I: update po/*.po based on debian-reference.en.xmlt"
po4a po4a.cfg