Skip to content

Commit

Permalink
feat(translation): FIx handling of android library custom path
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Nov 14, 2024
1 parent 488744e commit aa35b50
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions translations/handlePlainTranslations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ versions="$default_branch $(git branch -r | grep -E "origin\/stable\-[0-9\.]+$"
if [ -d src/main/res ]; then
rm -rf src/main/res/values-*/strings.xml
fi
# Android library
if [ -d library/src/main/res ]; then
rm -rf library/src/main/res/values-*/strings.xml
fi
# Android talk app
if [ -d app/src/main/res ]; then
rm -rf app/src/main/res/values-*/strings.xml
Expand Down Expand Up @@ -59,6 +63,35 @@ if [ $1 = "nextcloud" -a $2 = "android" ]; then
rm -rf stable-values
fi

if [ $1 = "nextcloud" -a $2 = "android-library" ]; then
mkdir stable-values
for version in $versions
do
git checkout $version

cp library/src/main/res/values/strings.xml stable-values/$version.xml
done

cd stable-values
echo '<?xml version="1.0" encoding="utf-8"?>
<resources>' >> combined.xml

grep -h "<string" *.xml | sort -u | sed s'#\t# #'g >> combined.xml

# plurals are hard to compare, so we take only master/main ones
awk '/<plurals/,/<\/plurals>/' "$default_branch.xml" >> combined.xml

echo "</resources>" >> combined.xml

cat combined.xml

mv combined.xml ../library/src/main/res/values/strings.xml

cd ..

rm -rf stable-values
fi

if [ $1 = "nextcloud" -a $2 = "talk-android" ]; then
mkdir stable-values
for version in $versions
Expand Down Expand Up @@ -97,6 +130,11 @@ if [ $1 = "nextcloud" -a $2 = "android" ]; then
git checkout $default_branch
fi

if [ $1 = "nextcloud" -a $2 = "android-library" ]; then
git checkout -- library/src/main/res/values/strings.xml
git checkout $default_branch
fi

if [ $1 = "nextcloud" -a $2 = "talk-android" ]; then
git checkout -- app/src/main/res/values/strings.xml
git checkout $default_branch
Expand Down Expand Up @@ -133,6 +171,12 @@ do
mv src/main/res/values-de-rDE src/main/res/values-de
fi

# for the Android library rename the informal german to the formal version
if [ -d library/src/main/res ]; then
rm -rf library/src/main/res/values-de
mv library/src/main/res/values-de-rDE library/src/main/res/values-de
fi

# for the Android talk and files app rename the informal german to the formal version
if [ -d app/src/main/res ]; then
rm -rf app/src/main/res/values-de
Expand Down

0 comments on commit aa35b50

Please sign in to comment.