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
41 changes: 41 additions & 0 deletions translations-app/Dockerfile-Isolated
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM ubuntu:24.04

MAINTAINER Morris Jobke <[email protected]>

Check warning on line 3 in translations-app/Dockerfile-Isolated

View workflow job for this annotation

GitHub Actions / Push Docker image translations-app-debug:latest to GitHub Packages

The MAINTAINER instruction is deprecated, use a label instead to define an image author

MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label More info: https://docs.docker.com/go/dockerfile/rule/maintainer-deprecated/

# Install python
RUN apt-get update -q && \
DEBIAN_FRONTEND=noninteractive apt-get install -q -y --no-install-recommends \
gawk \
gettext \
git \
gnupg \
make \
curl \
openssh-client \
ca-certificates \
php8.3-cli \
php8.3-xml \
jq \
&& apt-get clean

# qttools5-dev-tools \

RUN update-ca-certificates

# Install Transifex client
RUN cd /root
RUN curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash

ENV PATH=${PATH}:/

RUN mkdir -p /app

ADD temp/gitconfig /root/.gitconfig
ADD temp/known_hosts /root/.ssh/known_hosts
ADD temp/translationtool.phar /translationtool.phar
ADD temp/validateTranslationFiles.sh /validateTranslationFiles.sh
ADD handleAppTranslations.sh /handleTranslations.sh

WORKDIR /app

ENTRYPOINT ["/handleTranslations.sh"]
6 changes: 6 additions & 0 deletions translations-app/temp/gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[user]
name = Nextcloud bot
email = [email protected]
signingkey = 130DAB86D3FB356C
[commit]
gpgsign = true
1 change: 1 addition & 0 deletions translations-app/temp/known_hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
|1|1UjtW4nPQl6dagFTSOuutRaPW94=|XdY1lJH2X/d4RM450XX6pSGF3lA= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
Binary file added translations-app/temp/translationtool.phar
Binary file not shown.
67 changes: 67 additions & 0 deletions translations-app/temp/validateTranslationFiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/sh

cd $1

EXIT_CODE=0
# Confirm German translation does not have the false "don't translate" warning
if [ $(jq '.translations[]' l10n/de.json | grep 'Benötigt keine Übersetzung. Hier wird nur die formelle Übersetzung verwendet (de_DE).' | wc -l) -ne 0 ]; then
echo "German language file $1/l10n/de.json contains the 'Benötigt keine Übersetzung. Hier wird nur die formelle Übersetzung verwendet (de_DE).' hint." 1>&2
EXIT_CODE=3
fi

# Confirm English source does not contain the pipe character which breaks the Symfony Translation library
if [ $(jq '.translations | keys[]' l10n/en_GB.json | grep '|' | wc -l) -ne 0 ]; then
echo "" 1>&2
echo "English source $1/l10n/en_GB.json contains the pipe character" 1>&2
echo "---" 1>&2
jq '.translations | keys[]' l10n/en_GB.json | grep '|' 1>&2
EXIT_CODE=4
fi

# Confirm English source does not contain the unicode single quote character
if [ $(jq '.translations | keys[]' l10n/en_GB.json | grep -E '(´|’)' | wc -l) -ne 0 ]; then
echo "" 1>&2
echo "English source $1/l10n/en_GB.json contains unicode single quote character, that should be replaced by normal single quotes" 1>&2
echo "---" 1>&2
jq '.translations | keys[]' l10n/en_GB.json | grep -E '(´|’)' 1>&2
EXIT_CODE=4
fi

# Confirm English source does not use triple dots
if [ $(jq '.translations | keys[]' l10n/en_GB.json | grep '\.\.\.' | wc -l) -ne 0 ]; then
echo "" 1>&2
echo "English source $1/l10n/en_GB.json contains three consecutive dots. Unicode … should be used instead" 1>&2
echo "---" 1>&2
jq '.translations | keys[]' l10n/en_GB.json | grep '\.\.\.' 1>&2
EXIT_CODE=4
fi

# Check for leading or trailing spaces
if [ $(jq '.translations | keys[]' l10n/en_GB.json | grep -E '(^\"(\s|\\t|\\n)|(\s|\\t|\\n)\"$)' | wc -l) -ne 0 ]; then
echo "" 1>&2
echo "English source $1/l10n/en_GB.json contains leading or trailing white spaces, tabs or new lines" 1>&2
echo "---" 1>&2
jq '.translations | keys[]' l10n/en_GB.json | grep -E '(^\"(\s|\\t|\\n)|(\s|\\t|\\n)\"$)' 1>&2
EXIT_CODE=4
fi

for file in $(ls l10n/*.json)
do
# Make sure only RTL languages contain such characters
if [ "$file" != "l10n/ar.json" -a "$file" != "l10n/fa.json" -a "$file" != "l10n/he.json" -a "$file" != "l10n/ps.json" -a "$file" != "l10n/ug.json" -a "$file" != "l10n/ur_PK.json" ]; then
if [ $(jq '.translations[]' $file | grep -E '(\x{061C}|\x{0623}|\x{200E}|\x{200F}|\x{202A}|\x{202B}|\x{202C}|\x{202D}|\x{202E}|\x{2066}|\x{2067}|\x{2068}|\x{2069}|\x{206C}|\x{206D})' | wc -l) -ne 0 ]; then
echo "$1/$file contains a RTL limited characters in the translations" 1>&2
EXIT_CODE=5
fi
fi

# Confirm translations do not contain the pipe character which breaks the Symfony Translation library
if [ $(jq '.translations[]' $file | grep '|' | wc -l) -ne 0 ]; then
echo "$1/$file contains the pipe character" 1>&2
EXIT_CODE=6
fi
done

cd -

exit $EXIT_CODE