mirror of
https://github.com/thomiceli/opengist.git
synced 2024-12-22 12:32:40 +00:00
Check translations keys in CI (#279)
This commit is contained in:
parent
f705e879a1
commit
97636b23f5
7 changed files with 47 additions and 10 deletions
5
.github/workflows/go.yml
vendored
5
.github/workflows/go.yml
vendored
|
@ -41,9 +41,12 @@ jobs:
|
|||
with:
|
||||
go-version: "1.22"
|
||||
|
||||
- name: Check
|
||||
- name: Check Go modules
|
||||
run: make go_mod check_changes
|
||||
|
||||
- name: Check translations
|
||||
run: make check-tr
|
||||
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
|
5
Makefile
5
Makefile
|
@ -1,4 +1,4 @@
|
|||
.PHONY: all all_crosscompile install build_frontend build_backend build build_crosscompile build_docker build_dev_docker run_dev_docker watch_frontend watch_backend watch clean clean_docker check_changes go_mod fmt test
|
||||
.PHONY: all all_crosscompile install build_frontend build_backend build build_crosscompile build_docker build_dev_docker run_dev_docker watch_frontend watch_backend watch clean clean_docker check_changes go_mod fmt test check-tr
|
||||
|
||||
# Specify the name of your Go binary output
|
||||
BINARY_NAME := opengist
|
||||
|
@ -73,3 +73,6 @@ fmt:
|
|||
|
||||
test:
|
||||
@go test ./... -p 1
|
||||
|
||||
check-tr:
|
||||
@bash ./scripts/check-translations.sh
|
|
@ -132,9 +132,6 @@ auth.username: 'Benutzername'
|
|||
auth.password: 'Passwort'
|
||||
auth.register-instead: 'Stattdessen registrieren'
|
||||
auth.login-instead: 'Stattdessen anmelden'
|
||||
auth.github-oauth: 'Mit GitHub-Account fortfahren'
|
||||
auth.gitlab-oauth: 'Mit GitLab-Account fortfahren'
|
||||
auth.gitea-oauth: 'Mit Gitea-Account fortfahren'
|
||||
|
||||
error: 'Fehler'
|
||||
|
|
@ -157,7 +157,6 @@ admin.delete: Eliminar
|
|||
admin.created_at: Creado
|
||||
|
||||
admin.config-link: Esta configuración puede ser %s por un archivo de configuración YAML y/o variables de entorno.
|
||||
admin.config-link-overridden: sobrescrito
|
||||
admin.disable-signup: Deshabilitar registro
|
||||
admin.disable-signup_help: Prohibir la creación de nuevas cuentas.
|
||||
admin.require-login: Requerir inicio de sesión
|
||||
|
|
|
@ -187,7 +187,6 @@ settings.create-password-help: Créer un mot de passe pour se connecter à Openg
|
|||
settings.change-password: Changer le mot de passe
|
||||
settings.change-password-help: Changer le mot de passe pour se connecter à Opengist via HTTP
|
||||
settings.password-label-title: Mot de passe
|
||||
auth.gitlab-oauth: Continuer avec un compte GitLab
|
||||
admin.actions.sync-previews: Synchroniser l'aperçu des gists
|
||||
admin.actions.reset-hooks: Réinitialiser les hooks de Git pour tous les dépôts
|
||||
gist.new.url: URL
|
||||
|
|
|
@ -17,8 +17,6 @@ gist.header.clone-http: Clonar via %s
|
|||
gist.header.clone-http-help: Clonar com Git usando autenticação básica HTTP.
|
||||
gist.header.clone-ssh: Clonar via SSH
|
||||
gist.header.clone-ssh-help: Clonar com Git usando uma chave SSH.
|
||||
gist.header.share: Compartilhar
|
||||
gist.header.share-help: Copiar link para compartilhar este gist.
|
||||
gist.header.download-zip: Baixar ZIP
|
||||
|
||||
gist.raw: Bruto
|
||||
|
@ -157,7 +155,6 @@ admin.delete: Excluir
|
|||
admin.created_at: Criado
|
||||
|
||||
admin.config-link: Esta configuração pode ser %s por um arquivo de configuração YAML e/ou variáveis de ambiente.
|
||||
admin.config-link-overridden: sobrescrito
|
||||
admin.disable-signup: Desabilitar registro
|
||||
admin.disable-signup_help: Proibir a criação de novas contas.
|
||||
admin.require-login: Exigir login
|
||||
|
|
39
scripts/check-translations.sh
Executable file
39
scripts/check-translations.sh
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
differences_found=0
|
||||
|
||||
# Extract keys from the reference file and sort them
|
||||
sort <(awk -F':' '{print $1}' internal/i18n/locales/en-US.yml) > sorted_reference_keys.txt
|
||||
sed -i '/^\s*$/d' sorted_reference_keys.txt
|
||||
|
||||
for new_file in internal/i18n/locales/*.yml; do
|
||||
filename=$(basename $new_file)
|
||||
echo ""
|
||||
echo "Checking $filename..."
|
||||
|
||||
# Extract keys from the current file and sort them
|
||||
sort <(awk -F':' '{print $1}' $new_file) > sorted_new_keys.txt
|
||||
sed -i '/^\s*$/d' sorted_new_keys.txt
|
||||
|
||||
comm -3 sorted_reference_keys.txt sorted_new_keys.txt > differences.txt
|
||||
|
||||
if [ -s differences.txt ]; then
|
||||
echo "Error in $filename: The YAML file has differences in keys."
|
||||
while IFS= read -r line; do
|
||||
if [[ $line == $'\t'* ]]; then
|
||||
echo "+ Additional key in $filename: $(echo $line | awk '{$1=$1; print}')"
|
||||
else
|
||||
echo "- Missing key in $filename: $(echo $line | awk '{$1=$1; print}')"
|
||||
fi
|
||||
done < differences.txt
|
||||
differences_found=1
|
||||
else
|
||||
echo "All keys in $filename match perfectly."
|
||||
fi
|
||||
|
||||
rm sorted_new_keys.txt
|
||||
done
|
||||
|
||||
rm sorted_reference_keys.txt differences.txt
|
||||
|
||||
exit $differences_found
|
Loading…
Reference in a new issue