~adamreichold/qpdfview/trunk

« back to all changes in this revision

Viewing changes to miscellaneous/import-translations.sh

  • Committer: Adam Reichold
  • Date: 2021-04-23 17:04:54 UTC
  • Revision ID: adam.reichold@t-online.de-20210423170454-cw8xnzachzko18se
Adds scripts to automatically export translation templates and import translations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash -xe
 
2
 
 
3
set -o pipefail
 
4
 
 
5
source_dir=../translations-export
 
6
dest_dir=./translations
 
7
 
 
8
# trap 'rm -f "${temp_file}"' EXIT
 
9
# temp_file="$(mktemp)"
 
10
 
 
11
for source_file in ${source_dir}/*.po
 
12
do
 
13
    locale="$(basename ${source_file} .po)"
 
14
    dest_file="${dest_dir}/qpdfview_${locale}.ts"
 
15
 
 
16
    sed "s/^\"X-Generator:..*/\"X-Qt-Contexts: true\\\\n\"/" "${source_file}" \
 
17
    | sed -r "/^msgctxt \"[^Qq][^:]+\"/ s/^msgctxt \"([^Qq][^:|\"]+)|\"$/msgctxt \"qpdfview::\1/" \
 
18
    | lconvert -if po -i - -o "${dest_file}"
 
19
done
 
20
 
 
21
lupdate -no-obsolete ./qpdfview.pro
 
22
 
 
23
source_dir=../translations-export/help
 
24
dest_dir=./help
 
25
 
 
26
for source_file in ${source_dir}/*.po
 
27
do
 
28
    locale="$(basename ${source_file} .po)"
 
29
    dest_file="${dest_dir}/help_${locale}.html"
 
30
 
 
31
    po4a-translate --format xhtml --master "${dest_dir}/help.html" --master-charset utf-8 \
 
32
        --localized "${dest_file}" --localized-charset utf-8 \
 
33
        --po "${source_file}" --keep 0
 
34
done