Make scripts more portable

environments/review-docs-trace-4s67rt/deployments/6715
heyarne 2021-04-07 07:18:17 +00:00 zatwierdzone przez Georg Krause
rodzic 5fded7a701
commit 39405bbc3e
7 zmienionych plików z 26 dodań i 8 usunięć

Wyświetl plik

@ -0,0 +1 @@
Frontend build tooling is less dependent on `npm` or `yarn` being used (!1285)

Wyświetl plik

@ -1,4 +1,6 @@
#!/bin/bash -eux
#!/usr/bin/env -S bash -eux
cd "$(dirname $0)/.." # change into base directory
find node_modules/fomantic-ui-css/components -name "*.min.css" -delete
mkdir -p node_modules/fomantic-ui-css/tweaked

Wyświetl plik

@ -1,9 +1,13 @@
#!/bin/bash -eux
#!/usr/bin/env -S bash -eux
cd "$(dirname $0)/.." # change into base directory
source scripts/utils.sh
locales=$(tail -n +2 src/locales.js | sed -e 's/export default //' | jq '.locales[].code' | grep -v 'en_US' | xargs echo)
mkdir -p src/translations
for locale in $locales; do
$(yarn bin)/gettext-compile locales/$locale/LC_MESSAGES/app.po --output src/translations/$locale.json
$(npm_binaries)/gettext-compile locales/$locale/LC_MESSAGES/app.po --output src/translations/$locale.json
done
# find locales -name '*.po' | xargs $(yarn bin)/gettext-compile --output src/translations.json
# find locales -name '*.po' | xargs $(npm_binaries)/.bin/gettext-compile --output src/translations.json

Wyświetl plik

@ -1,4 +1,8 @@
#!/bin/bash -eux
#!/usr/bin/env -S bash -eux
cd "$(dirname $0)/.." # change into base directory
source scripts/utils.sh
locales=$(tail -n +2 src/locales.js | sed -e 's/export default //' | jq '.locales[].code' | xargs echo)
locales_dir="locales"
sources=$(find src -name '*.vue' -o -name '*.html' 2> /dev/null)
@ -7,7 +11,7 @@ touch $locales_dir/app.pot
GENERATE=${GENERATE-true}
# Create a main .pot template, then generate .po files for each available language.
# Extract gettext strings from templates files and create a POT dictionary template.
$(yarn bin)/gettext-extract --attribute v-translate --quiet --output $locales_dir/app.pot $sources
$(npm_binaries)/gettext-extract --attribute v-translate --quiet --output $locales_dir/app.pot $sources
xgettext --language=JavaScript --keyword=npgettext:1c,2,3 \
--from-code=utf-8 --join-existing --no-wrap \
--package-name=$(node -e "console.log(require('./package.json').name);") \

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash -eu
#!/usr/bin/env -S bash -eux
# Typical use:
# cp -r locales old_locales
@ -6,6 +6,8 @@
# ./scripts/i18n-populate-contextualized-strings.sh old_locales locales
# Then review/commit the changes
cd "$(dirname $0)/.." # change into base directory
old_locales_dir=$1
new_locales_dir=$2

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash -eux
#!/usr/bin/env -S bash -eux
integration_branch="translations-integration"
git remote add weblate https://translate.funkwhale.audio/git/funkwhale/front/ || echo "remote already exists"
git fetch weblate

Wyświetl plik

@ -0,0 +1,5 @@
#!/usr/bin/env bash -S -eux
npm_binaries () {
command -v yarn > /dev/null && yarn bin || npm bin
}