add script to merge variables

This commit is contained in:
Moriz Wahl 2022-10-12 15:33:07 +02:00
parent 111b1da00d
commit 9045ac3199
3 changed files with 20 additions and 1 deletions

3
branding/locales/de.json Normal file
View File

@ -0,0 +1,3 @@
{
"new-key": "This is a new key"
}

View File

@ -12,9 +12,15 @@ FROM $APP_IMAGE_CODE as code
# copy public constants into the Docker image to brand it
COPY branding/static/ static/
COPY branding/constants/ constants/
COPY branding/locales/ locales/
COPY branding/locales/html/ locales/html/
# COPY branding/locales/index.js locales/index.js
COPY branding/locales/*.json locales/tmp/
COPY branding/assets/styles/imports/ assets/styles/imports/
RUN apk add --no-cache bash jq
RUN tools/merge-locales.sh
## Something like (bash, jq must be installed)
# for locale in `ls locales/*.json`; do jq -s '.[0] * .[1]' source/$locale $locale; done;

10
tools/merge-locales.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
for locale in `ls locales/*.json`;
do
file = basename $locale;
if [ -f locales/tmp/$file ]; then
jq -s '.[0] * .[1]' $locale locales/tmp/$file > locales/tmp/tmp.json;
mv locales/tmp/tmp.json $locale;
fi;
done;