summaryrefslogtreecommitdiff
path: root/build/po_functions
blob: 6b954b3dea267a4968f1f4f4267179e2b3533b59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Routines used to build manual translations from po-files

update_templates () {
    echo "Generating integrated XML files and POT files"
    bash -c "cd .. ; ./scripts/merge_xml en"
    RET=$?; [ $RET -ne 0 ] && exit 1 || true
    bash -c "cd .. ; ./scripts/update_pot"
    RET=$?; [ $RET -ne 0 ] && exit 1 || true
}

# Check whether language uses PO files for translation
uses_po () {
    if [ -d "../po/$lang" ] ; then
        if [ -d "../$lang/" ] && svn info "../$lang" >/dev/null 2>&1 ; then
            echo "Warning: both PO files and XML files are present; ignoring PO files"
        else
            return 0
        fi
    fi
    return 1
}

generate_xml () {
    sh -c "cd ..; ./scripts/update_po $lang"
    RET=$?; [ $RET -ne 0 ] && return $RET || true

    sh -c "cd ..; ./scripts/create_xml $lang 2>&1 | grep -v 'found empty tag para'"
    RET=$?; [ $RET -ne 0 ] && return $RET || true

    echo "Info: generation of XML files complete"
    return 0
}

clear_xml () {
    for lang in $languages; do
        if [ -d ../po/$lang ] && [ -d ../$lang/ ] && ! svn info ../$lang/ >/dev/null 2>&1 ; then
            rm -rf ../$lang
        fi
    done
}

clear_po () {
    rm -rf ./build.po
}