Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
- name: Build container image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
platforms: ${{ startsWith(github.event.inputs.folderPath, 'client') && 'linux/amd64' || 'linux/amd64,linux/arm64' }}
platforms: ${{ (startsWith(github.event.inputs.folderPath, 'client') || startsWith(github.event.inputs.folderPath, 'translations')) && 'linux/amd64' || 'linux/amd64,linux/arm64' }}
push: true
context: ${{ github.event.inputs.folderPath }}
file: '${{ github.event.inputs.folderPath }}/${{ github.event.inputs.dockerFile }}'
Expand Down
14 changes: 14 additions & 0 deletions translations/Dockerfile-Debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ghcr.io/nextcloud/continuous-integration-translations:latest

LABEL org.opencontainers.image.authors="Joas Schilling <[email protected]>"

ADD handleTranslations.sh /handleTranslations.sh

RUN apt update && apt install -y wget

RUN cd /root

RUN wget http://archive.ubuntu.com/ubuntu/pool/main/g/gettext/gettext_0.23.1-1_amd64.deb -O /root/gettext_0.23.1-1_amd64.deb \
&& apt install -y /root/gettext_0.23.1-1_amd64.deb

RUN gettext --version
90 changes: 6 additions & 84 deletions translations/handleTranslations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,88 +81,10 @@ do
msgcat --use-first stable-templates/*.$name > translationfiles/templates/$name
done

# remove intermediate POT files
rm -rf stable-templates
BRANCH_NAME=nickv/$(date '+%H%M')
git checkout -b $BRANCH_NAME
git add translationfiles/templates -f
git add stable-templates -f

# Checkout master so we have the newest .tx/config with the newest list of resources
git checkout master

# push sources
tx push -s

# pull translations - force pull because a fresh clone has newer time stamps
tx pull -f -a --minimum-perc=50
# pull all "lib" translations for the language name
tx pull -a -f -r nextcloud.lib --minimum-perc=0
# pull 20% of "settings" translations for the region name
tx pull -a -f -r nextcloud.settings-1 --minimum-perc=20


# delete removed l10n files
find core/l10n/*.js -type f -delete
find core/l10n/*.json -type f -delete
find lib/l10n/*.js -type f -delete
find lib/l10n/*.json -type f -delete
find apps/*/l10n/*.js -type f -delete
find apps/*/l10n/*.json -type f -delete

# build JS/JSON based on translations
/translationtool.phar convert-po-files

##################################
# Add translations to branches again
##################################
for version in $versions
do
if [ ! -d /app/$version ]; then
# skip if the branch doesn't exist
continue
fi

cd /app/$version

# delete removed l10n files that are used for language detection (they will be recreated during the write)
find core/l10n/*.js -type f -delete
find core/l10n/*.json -type f -delete
find lib/l10n/*.js -type f -delete
find lib/l10n/*.json -type f -delete
find apps/*/l10n/*.js -type f -delete
find apps/*/l10n/*.json -type f -delete

# Copy JS and JSON
cd /app/default
find core/l10n/*.js -type f -exec cp {} /app/$version/{} \;
find core/l10n/*.json -type f -exec cp {} /app/$version/{} \;
find lib/l10n/*.js -type f -exec cp {} /app/$version/{} \;
find lib/l10n/*.json -type f -exec cp {} /app/$version/{} \;
find apps/*/l10n/*.js -type f -exec cp {} /app/$version/{} \;
find apps/*/l10n/*.json -type f -exec cp {} /app/$version/{} \;
cd /app/$version

# create git commit and push it
git add apps core lib

git commit -am "fix(l10n): Update translations from Transifex" -s || true
git push origin $version

echo "done with $version"
done

##################################
# Validate translations
##################################
cd /app/default
set +xe
EXIT_CODE=0
/validateTranslationFiles.sh core
EXIT_CODE=$(($?+$EXIT_CODE))
/validateTranslationFiles.sh lib
EXIT_CODE=$(($?+$EXIT_CODE))

for app in $(ls apps)
do
if [ -d "apps/$app/l10n" ]; then
/validateTranslationFiles.sh apps/$app
EXIT_CODE=$(($?+$EXIT_CODE))
fi
done;
git commit -am "fix(l10n): Update translations from Transifex" -s || true
git push origin $BRANCH_NAME