update scripts to new res and assets folder location

This commit is contained in:
adbenitez 2024-06-12 22:17:54 +02:00
parent cae954aa51
commit bd669edf4e
7 changed files with 26 additions and 19 deletions

View file

@ -3,8 +3,8 @@ host = https://www.transifex.com
lang_map = id: in, ja_JP: ja, nl_NL: nl, pt_BR: pt-rBR, zh_CN: zh-rCN, zh_TW: zh-rTW
[o:delta-chat:p:delta-chat-app:r:stringsxml]
file_filter = res/values-<lang>/strings.xml
source_file = res/values/strings.xml
file_filter = src/main/res/values-<lang>/strings.xml
source_file = src/main/res/values/strings.xml
source_lang = en
type = ANDROID

View file

@ -7,18 +7,19 @@ then
fi
LANG=$1
RES=src/main/res
mkdir res/values-$LANG/
mkdir $RES/values-$LANG/
cp res/values/strings.xml res/values-$LANG/strings.xml
cp $RES/values/strings.xml $RES/values-$LANG/strings.xml
# set time to old date because transifex may have different file times
# and does not overwrite old file
# (using -t as sth. as -d "100 days ago" does not work on mac)
touch -t 201901010000 res/values-$LANG/strings.xml
touch -t 201901010000 $RES/values-$LANG/strings.xml
echo "res/values-$LANG/strings.xml added:"
echo "- add the name to res/values/arrays.xml"
echo "$RES/values-$LANG/strings.xml added:"
echo "- add the name to $RES/values/arrays.xml"
echo "- if needed, language mappings can be added to .tx/config"
echo "- pull translations using ./scripts/tx-pull-translations.sh"
echo " (on problems, 'tx -d pull' gives verbose output)"

View file

@ -1,20 +1,22 @@
echo potential errors, if any:
RES=./src/main/res
# a space after the percent sign
# results in an IllegalFormatException in getString()
grep --include='strings.xml' -r '\% [12]' ./res/
grep --include='strings.xml' -r '\%[$]' ./res/
grep --include='strings.xml' -r '\$ ' ./res/
grep --include='strings.xml' -r ' \$' ./res/
grep --include='strings.xml' -r '\% [12]' $RES
grep --include='strings.xml' -r '\%[$]' $RES
grep --include='strings.xml' -r '\$ ' $RES
grep --include='strings.xml' -r ' \$' $RES
# check for broken usage of escape sequences:
# - alert on `\ n`, `\ N`, `\n\Another paragraph` and so on
# - allow only `\n`, `\"`, `\'` and `\`
# (`` might not be escaped, but it is done often eg. in "sq", so we allow that for now)
grep --include='strings.xml' -r "\\\\[^n\"']" ./res/
grep --include='strings.xml' -r "\\\\[^n\"']" $RES
# check for usage of a single `&` - this has to be an `&amp;`
grep --include='strings.xml' -r "&[^a]" ./res/
grep --include='strings.xml' -r "&[^a]" $RES
# single <br> is not needed - and not allowed in xml, leading to error "matching end tag missing"
grep --include='strings.xml' -r "<br" ./res/
grep --include='strings.xml' -r "<br" $RES

View file

@ -1,4 +1,7 @@
#!/bin/sh
MAIN=./src/main
codespell \
--skip './.git,./build,./res/values-*/strings.xml,,./assets/help,./jni/deltachat-core-rust' \
--skip './.git,./build,$MAIN/res/values-*/strings.xml,,$MAIN/assets/help,./jni/deltachat-core-rust' \
--ignore-words-list formattings

View file

@ -1 +1 @@
../deltachat-pages/tools/create-local-help.py ../deltachat-pages/_site assets/help
../deltachat-pages/tools/create-local-help.py ../deltachat-pages/_site src/main/assets/help

View file

@ -1,4 +1,5 @@
RES=src/main/res
tx pull -l en
mv res/values-en/strings.xml res/values/strings.xml
rmdir res/values-en
mv $RES/values-en/strings.xml $RES/values/strings.xml
rmdir $RES/values-en
./scripts/check-translations.sh

View file

@ -1,3 +1,3 @@
read -p "Push res/values/strings.xml to transifex? Press ENTER to continue, CTRL-C to abort."
read -p "Push src/main/res/values/strings.xml to transifex? Press ENTER to continue, CTRL-C to abort."
tx push -s
./scripts/check-translations.sh