-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathupdate_translation.sh
More file actions
executable file
·46 lines (37 loc) · 1018 Bytes
/
update_translation.sh
File metadata and controls
executable file
·46 lines (37 loc) · 1018 Bytes
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
45
46
#!/usr/bin/env bash
# Credit: https://gitlab.gnome.org/World/Upscaler/-/blob/main/update_translation.sh?ref_type=heads
export PROJECT_NAME="ignition"
export BUILD_DIR="translation-build/"
export PO_DIR="po/"
export LINGUAS_FILE="${PO_DIR}LINGUAS"
export POTFILES_FILE="${PO_DIR}POTFILES"
# Cleanup on exit, whether early or normal
cleanup() {
unset PROJECT_NAME
unset BUILD_DIR
unset PO_DIR
unset LINGUAS_FILE
unset POTFILES_FILE
}
trap cleanup EXIT
# Update the POTFILES file
./update_potfiles.py
if [ $? -ne 0 ]; then
echo "Error: update_potfiles.py failed. Exiting."
exit 1
fi
# Update the LINGUAS file
rm "${LINGUAS_FILE}"
for po_file in "${PO_DIR}"*.po; do
lang=$(basename "${po_file}" .po)
echo "${lang}" >> "${LINGUAS_FILE}"
echo "Wrote ${lang} to ${LINGUAS_FILE}"
done
echo -e "Updated ${LINGUAS_FILE}\n"
# Update the translation template
if [ -d "${BUILD_DIR}" ]; then
rm -r "${BUILD_DIR}"
fi
meson "${BUILD_DIR}"
meson compile -C "${BUILD_DIR}" "${PROJECT_NAME}-pot"
rm -r "${BUILD_DIR}"