2018-01-04 13:58:24 +03:00
|
|
|
#!/bin/bash
|
2017-12-15 13:45:53 +03:00
|
|
|
|
2024-03-29 18:56:51 +03:00
|
|
|
# SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
# SPDX-FileCopyrightText: 2017-2018-2024 Tobias Kaminsky <tobias@kaminsky.me>
|
2024-04-30 13:16:39 +03:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
2024-03-29 18:56:51 +03:00
|
|
|
|
2017-12-15 13:45:53 +03:00
|
|
|
cd scripts/screenshots/
|
2019-06-26 15:38:00 +03:00
|
|
|
for i in $(find ../../fastlane | grep png | grep Screenshots) ; do
|
2017-12-15 13:45:53 +03:00
|
|
|
device=$(echo $i | cut -d"/" -f8 | sed s'#Screenshots##')
|
|
|
|
textID=$(echo $i | cut -d"/" -f9 | cut -d"_" -f1,2)
|
|
|
|
locale=$(echo $i | cut -d"/" -f6)
|
2019-06-26 15:38:00 +03:00
|
|
|
|
2017-12-15 13:45:53 +03:00
|
|
|
# handle some locales different
|
|
|
|
case $locale in
|
|
|
|
"en-US")
|
|
|
|
locale=""
|
|
|
|
;;
|
2019-06-26 15:38:00 +03:00
|
|
|
"en-GB")
|
|
|
|
locale="-b+en+001"
|
|
|
|
;;
|
2018-01-04 14:05:04 +03:00
|
|
|
"de-DE")
|
2019-06-26 15:38:00 +03:00
|
|
|
locale="-de"
|
2018-02-08 11:03:21 +03:00
|
|
|
;;
|
|
|
|
"es-MX")
|
|
|
|
locale="-es-rMX"
|
|
|
|
;;
|
|
|
|
"hu-HU")
|
|
|
|
locale="-hu-rHU"
|
|
|
|
;;
|
|
|
|
"ka-GE")
|
|
|
|
locale="-ka-rGE"
|
|
|
|
;;
|
|
|
|
"no-NO")
|
|
|
|
locale="-nb-rNO"
|
|
|
|
;;
|
|
|
|
"pt-BR")
|
|
|
|
locale="-pt-rBR"
|
2018-01-04 14:05:04 +03:00
|
|
|
;;
|
2019-06-26 15:38:00 +03:00
|
|
|
"pt-PT")
|
|
|
|
locale="-pt-rPT"
|
|
|
|
;;
|
|
|
|
"bg-BG")
|
|
|
|
locale="-bg-rBG"
|
|
|
|
;;
|
|
|
|
"fi-FI")
|
|
|
|
locale="-fi-rFI"
|
|
|
|
;;
|
|
|
|
"uk-UK")
|
|
|
|
locale=""
|
|
|
|
;;
|
|
|
|
"ja-JP")
|
|
|
|
locale="-ja-rJP"
|
|
|
|
;;
|
|
|
|
"lt-LT")
|
|
|
|
locale="-lt-rLT"
|
|
|
|
;;
|
|
|
|
"zh-HK")
|
|
|
|
locale="-zh-rCN"
|
|
|
|
;;
|
|
|
|
"zk-CN")
|
|
|
|
locale="-zh-rCN"
|
|
|
|
;;
|
|
|
|
"id-ID")
|
|
|
|
locale="-in"
|
|
|
|
;;
|
|
|
|
"cs-CZ")
|
|
|
|
locale="-cs-rCZ"
|
|
|
|
;;
|
2017-12-15 13:45:53 +03:00
|
|
|
*)
|
2018-02-08 11:03:21 +03:00
|
|
|
locale="-"$(echo $locale | cut -d"-" -f1)
|
2017-12-15 13:45:53 +03:00
|
|
|
esac
|
2019-06-26 15:38:00 +03:00
|
|
|
|
2022-03-11 13:32:01 +03:00
|
|
|
if [ -e ../../app/src/main/res/values$locale/strings.xml ] ; then
|
|
|
|
heading=$(grep $textID"_heading" ../../app/src/main/res/values$locale/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&#\\&#')
|
|
|
|
subline=$(grep $textID"_subline" ../../app/src/main/res/values$locale/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&#\\&#')
|
2018-01-04 13:58:24 +03:00
|
|
|
else
|
2019-06-26 15:38:00 +03:00
|
|
|
heading=""
|
|
|
|
subline=""
|
2018-01-04 13:58:24 +03:00
|
|
|
fi
|
2019-06-26 15:38:00 +03:00
|
|
|
|
2017-12-15 13:45:53 +03:00
|
|
|
# fallback to english if there is not translation
|
2019-06-26 15:38:00 +03:00
|
|
|
if [ -z "$heading" ]; then
|
2022-03-11 13:32:01 +03:00
|
|
|
heading=$(grep $textID"_heading" ../../app/src/main/res/values/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&#\\&#')
|
2017-12-15 13:45:53 +03:00
|
|
|
fi
|
|
|
|
|
2019-06-26 15:38:00 +03:00
|
|
|
if [ -z "$subline" ]; then
|
2022-03-11 13:32:01 +03:00
|
|
|
subline=$(grep $textID"_subline" ../../app/src/main/res/values/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&#\\&#')
|
2019-06-26 15:38:00 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
sed "s#{image}#$i#;s#{heading}#$heading#;s#{subline}#$subline#g" $device.svg > temp.svg
|
|
|
|
|
2017-12-15 13:45:53 +03:00
|
|
|
if [ $textID == "06_davdroid" ] ; then
|
|
|
|
sed "s#display:none#display:visible#" -i temp.svg
|
|
|
|
fi
|
2019-06-26 15:38:00 +03:00
|
|
|
|
2018-02-12 13:47:27 +03:00
|
|
|
inkscape temp.svg -h 576 -e $i 2>/dev/null
|
2017-12-15 13:45:53 +03:00
|
|
|
done
|