1#!/bin/bash
2
3CURDIR="${PWD}"
4LNGDIR="${PWD}/lumina-i18n/ts"
5
6git clone https://github.com/pcbsd/lumina-i18n.git
7
8[[ ! -d "${LNGDIR}" ]] && (echo "something went wrong!" && exit 1)
9
10LANGS=("${LNGDIR}"/*)
11LANGS=(${LANGS[@]/*\/ts\/})
12
13UTILS=( config desktop fileinfo fm info open screenshot search textedit xconfig )
14
15for lng in ${LANGS[@]}; do
16	for utl in ${UTILS[@]}; do
17		if [[ -e "${LNGDIR}"/${lng}/lumina-${utl}.ts ]]; then
18			if [[ -d "${CURDIR}"/src-qt5/core/lumina-${utl} ]]; then
19				cp "${LNGDIR}"/${lng}/lumina-${utl}.ts \
20					"${CURDIR}"/src-qt5/core/lumina-${utl}/i18n/lumina-${utl}_${lng}.ts
21			elif [[ -d "${CURDIR}"/src-qt5/core-utils/lumina-${utl} ]]; then
22				cp "${LNGDIR}"/${lng}/lumina-${utl}.ts \
23					"${CURDIR}"/src-qt5/core-utils/lumina-${utl}/i18n/lumina-${utl}_${lng}.ts
24			elif [[ -d "${CURDIR}"/src-qt5/desktop-utils/lumina-${utl} ]]; then
25				cp "${LNGDIR}"/${lng}/lumina-${utl}.ts \
26					"${CURDIR}"/src-qt5/desktop-utils/lumina-${utl}/i18n/lumina-${utl}_${lng}.ts
27			fi
28		fi
29	done
30done
31
32echo "updated lumina translations."
33
34# satisfy dpkg-source when building a GIT snapshot
35# first ensure all translations are known to GIT
36# then create a commit using only the translation files
37# other changes to the source will still be tracked by dpkg-source
38[[ -d "${CURDIR}"/.git ]] && ( git add src-qt5/*/*/i18n/*.ts && git commit src-qt5/*/*/i18n/*.ts \
39	-m "merge latest translations from https://github.com/pcbsd/lumina-i18n.git" )
40
41rm -rf lumina-i18n
42