sorting keys, comparing de and en locales, yarn run locales

This commit is contained in:
Moriz Wahl 2020-02-18 16:21:21 +01:00
parent 3a33430298
commit 934c9906cc
13 changed files with 60 additions and 44 deletions

View File

@ -1,14 +1,17 @@
#! /usr/bin/env bash
ROOT_DIR=$(dirname "$0")/../..
english="$ROOT_DIR/webapp/locales/en.json"
german="$ROOT_DIR/webapp/locales/de.json"
sorting="jq -f $ROOT_DIR/scripts/translations/sort_filter.jq"
english="$sorting $ROOT_DIR/webapp/locales/en.json"
german="$sorting $ROOT_DIR/webapp/locales/de.json"
listPaths="jq -c 'path(..)|[.[]|tostring]|join(\".\")'"
if eval "diff -q <( $listPaths < $english ) <( $listPaths < $german )";
diffString="<( $english | $listPaths ) <( $german | $listPaths )"
if eval "diff -q $diffString";
then
: # all good
else
eval "diff -y <( $listPaths < $english ) <( $listPaths < $german )";
eval "diff -y $diffString | grep '[|<>]'";
printf "\nEnglish and German translation keys do not match, see diff above.\n"
exit 1
fi

View File

@ -1,12 +1,12 @@
#! /usr/bin/env bash
ROOT_DIR=$(dirname "$0")/..
ROOT_DIR=$(dirname "$0")/../..
tmp=$(mktemp)
exit_code=0
for locale_file in $ROOT_DIR/webapp/locales/*.json
do
jq --sort-keys . $locale_file > "$tmp"
jq -f $(dirname "$0")/sort_filter.jq $locale_file > "$tmp"
if [ "$*" == "--fix" ]
then
mv "$tmp" $locale_file

View File

@ -0,0 +1,13 @@
def walk(f):
. as $in
| if type == "object" then
reduce keys_unsorted[] as $key
( {}; . + { ($key): ($in[$key] | walk(f)) } ) | f
elif type == "array" then map( walk(f) ) | f
else f
end;
def keys_sort_by(f):
to_entries | sort_by(.key|f ) | from_entries;
walk(if type == "object" then keys_sort_by(ascii_upcase) else . end)

View File

@ -4,8 +4,8 @@
"create": "Erstellen",
"delete": "Löschen",
"edit": "Bearbeiten",
"loadMore": "mehr laden",
"loading": "wird geladen",
"loadMore": "mehr laden",
"save": "Speichern"
},
"admin": {
@ -143,8 +143,8 @@
"category": "Kategorie ::: Kategorien",
"comment": "Kommentar ::: Kommentare",
"letsTalk": "Miteinander reden",
"loadMore": "mehr laden",
"loading": "wird geladen",
"loadMore": "mehr laden",
"moreInfo": "Mehr Info",
"name": "Name",
"organization": "Organisation ::: Organisationen",
@ -371,11 +371,12 @@
"moderation": {
"name": "Moderation",
"reports": {
"DecisionSuccess": "Erfolgreich entschieden!",
"author": "Autor",
"content": "Inhalt",
"decideButton": "Bestätige",
"decided": "Entschieden",
"decideModal": {
"cancel": "Abbruch",
"Comment": {
"disable": {
"message": "Möchtest du den Kommentar \"<b>{name}</b>\" wirklich <b>gesperrt</b> lassen?",
@ -396,6 +397,7 @@
"title": "Entsperre den Beitrag abschließend"
}
},
"submit": "Bestätige Entscheidung",
"User": {
"disable": {
"message": "Möchtest du den Benutzer \"<b>{name}</b>\" wirklich <b>gesperrt</b> lassen?",
@ -405,12 +407,10 @@
"message": "Möchtest du den Benutzer \"<b>{name}</b>\" wirklich <b>entsperrt</b> lassen?",
"title": "Entsperre den Benutzer abschließend"
}
},
"cancel": "Abbruch",
"submit": "Bestätige Entscheidung"
}
},
"decided": "Entschieden",
"decision": "Entscheidung",
"DecisionSuccess": "Erfolgreich entschieden!",
"disabled": "Gesperrt",
"disabledAt": "Gesperrt am",
"disabledBy": "Gesperrt von",

View File

@ -4,8 +4,8 @@
"create": "Create",
"delete": "Delete",
"edit": "Edit",
"loadMore": "load more",
"loading": "loading",
"loadMore": "load more",
"save": "Save"
},
"admin": {
@ -143,8 +143,8 @@
"category": "Category ::: Categories",
"comment": "Comment ::: Comments",
"letsTalk": "Let`s Talk",
"loadMore": "load more",
"loading": "loading",
"loadMore": "load more",
"moreInfo": "More Info",
"name": "Name",
"organization": "Organization ::: Organizations",
@ -371,11 +371,12 @@
"moderation": {
"name": "Moderation",
"reports": {
"DecisionSuccess": "Decided successfully!",
"author": "Author",
"content": "Content",
"decideButton": "Confirm",
"decided": "Decided",
"decideModal": {
"cancel": "Cancel",
"Comment": {
"disable": {
"message": "Do you really want to let the comment \"<b>{name}</b>\" stay <b>disabled</b>?",
@ -396,6 +397,7 @@
"title": "Finally Enable Post"
}
},
"submit": "Confirm decision",
"User": {
"disable": {
"message": "Do you really want to let the user \"<b>{name}</b>\" stay <b>disabled</b>?",
@ -405,12 +407,10 @@
"message": "Do you really want to let the user \"<b>{name}</b>\" stay <b>enabled</b>?",
"title": "Finally Enable User"
}
},
"cancel": "Cancel",
"submit": "Confirm decision"
}
},
"decided": "Decided",
"decision": "Decision",
"DecisionSuccess": "Decided successfully!",
"disabled": "Disabled",
"disabledAt": "Disabled at",
"disabledBy": "Disabled by",

View File

@ -4,8 +4,8 @@
"create": "Crear",
"delete": "Borrar",
"edit": "Edite",
"loadMore": "cargar más",
"loading": "cargamento",
"loadMore": "cargar más",
"save": "Guardar"
},
"admin": {
@ -150,8 +150,8 @@
"category": "Categoría ::: Categorías",
"comment": "Comentario ::: Comentarios",
"letsTalk": "Hablemos",
"loadMore": "cargar más",
"loading": "cargando",
"loadMore": "cargar más",
"moreInfo": "Más información",
"name": "Nombre",
"organization": "Organización ::: Organizaciones",
@ -378,11 +378,12 @@
"moderation": {
"name": "Moderación",
"reports": {
"DecisionSuccess": "Decidido con éxito!",
"author": "Autor",
"content": "Contenido",
"decideButton": "Confirmar",
"decided": "Decidido",
"decideModal": {
"cancel": "Cancelar",
"Comment": {
"disable": {
"message": "¿Realmente quiere que el comentario \"<b>{nombre}</b>\" permanezca <b>desactivado</b>?",
@ -403,6 +404,7 @@
"title": "Finalmente Habilitar Contribución"
}
},
"submit": "Confirmar decisión",
"User": {
"disable": {
"message": "¿Realmente quiere que el usuario \"<b>{nombre}</b>\" permanezca <b>desactivado</b>?",
@ -412,12 +414,10 @@
"message": "¿Realmente quiere que el usuario \"<b>{nombre}</b>\" permanezca <b>habilitado</b>?",
"title": "Finalmente Habilitar Usuario"
}
},
"cancel": "Cancelar",
"submit": "Confirmar decisión"
}
},
"decided": "Decidido",
"decision": "Decisión",
"DecisionSuccess": "Decidido con éxito!",
"disabled": "Deshabilitado",
"disabledAt": "Deshabilitado el",
"disabledBy": "desactivado por",

View File

@ -4,8 +4,8 @@
"create": "Créer",
"delete": "Supprimer",
"edit": "Modifier",
"loadMore": "charger plus",
"loading": "chargement",
"loadMore": "charger plus",
"save": "Sauvegarder"
},
"admin": {
@ -150,8 +150,8 @@
"category": "Catégorie ::: Catégories",
"comment": "Commentaire ::: Commentaires",
"letsTalk": "Parlons-en",
"loadMore": "charger plus",
"loading": "chargement",
"loadMore": "charger plus",
"moreInfo": "Plus d'infos",
"name": "Nom",
"organization": "Organisation ::: Organisations",

View File

@ -4,8 +4,8 @@
"create": "Crea",
"delete": "Cancella",
"edit": "Modifica",
"loadMore": "Carica di più",
"loading": "Caricamento in corso",
"loadMore": "Carica di più",
"save": "Salva"
},
"admin": {
@ -150,8 +150,8 @@
"category": "Categoria ::: Categorie",
"comment": "Commento ::: Commenti",
"letsTalk": "Discutiamo",
"loadMore": "Caricare di più",
"loading": "Caricamento in corso",
"loadMore": "Caricare di più",
"moreInfo": "Ulteriori informazioni",
"name": "Nome",
"organization": "Organizzazione ::: Organizzazioni",

View File

@ -50,8 +50,8 @@
"category": "Categorie ::: Categorieën",
"comment": "Opmerking ::: Opmerkingen",
"letsTalk": "Laten we praten",
"loadMore": "meer laden",
"loading": "inlading",
"loadMore": "meer laden",
"moreInfo": "Meer info",
"name": "Naam",
"organization": "Organisatie ::: Organisaties",

View File

@ -4,8 +4,8 @@
"create": "Tworzenie",
"delete": "Usuń",
"edit": "Edycja",
"loadMore": "Obciążenie więcej",
"loading": "załadunek",
"loadMore": "Obciążenie więcej",
"save": "Oszczędzaj"
},
"admin": {
@ -65,8 +65,8 @@
"category": "Kategoria ::: Kategorie",
"comment": "Komentarz ::: Komentarze",
"letsTalk": "Porozmawiajmy",
"loadMore": "Obciążenie więcej",
"loading": "załadunek",
"loadMore": "Obciążenie więcej",
"moreInfo": "Więcej informacji",
"name": "Nazwa",
"organization": "Organization ::: Organizations",

View File

@ -4,8 +4,8 @@
"create": "Criar",
"delete": "Apagar",
"edit": "Editar",
"loadMore": "Carregar mais",
"loading": "Carregando",
"loadMore": "Carregar mais",
"save": "Salvar"
},
"admin": {
@ -150,8 +150,8 @@
"category": "Categoria ::: Categorias",
"comment": "Comentário ::: Comentários",
"letsTalk": "Vamos Conversar",
"loadMore": "Carregar mais",
"loading": "Carregando",
"loadMore": "Carregar mais",
"moreInfo": "Mais informações",
"name": "Nome",
"organization": "Organização ::: Organizações",

View File

@ -4,8 +4,8 @@
"create": "Создать",
"delete": "Удалить",
"edit": "Редактировать",
"loadMore": "Загрузить ещё",
"loading": "загрузка",
"loadMore": "Загрузить ещё",
"save": "Сохранить"
},
"admin": {
@ -150,8 +150,8 @@
"category": "Категория ::: Категории ::: Категории",
"comment": "Комментарий::: Комментарии::: Комментарии",
"letsTalk": "Давай поговорим",
"loadMore": "Загрузить ещё",
"loading": "загрузка",
"loadMore": "Загрузить ещё",
"moreInfo": "Больше информации",
"name": "Имя",
"organization": "Организация ::: Организации ::: Организации",
@ -378,11 +378,12 @@
"moderation": {
"name": "Модерация",
"reports": {
"DecisionSuccess": "Решил успешно!",
"author": "Автор",
"content": "Содержа́ние",
"decideButton": "Подтвердить",
"decided": "Решил",
"decideModal": {
"cancel": "Отменить",
"Comment": {
"disable": {
"message": "Вы действительно хотите, чтобы комментарий \"<b>{name}</b>\" остановиться и <b>отключен</b>?",
@ -403,6 +404,7 @@
"title": "Окончательно включить пост"
}
},
"submit": "Подтвердить решение",
"User": {
"disable": {
"message": "Вы действительно хотите, чтобы пользователь \"<b>{name}</b>\" остановиться и <b>отключен</b>?",
@ -412,12 +414,10 @@
"message": "Вы уверены, что хотите поделиться пользователем \"<b>{name}</b>\"?",
"title": "Окончательно включить пост"
}
},
"cancel": "Отменить",
"submit": "Подтвердить решение"
}
},
"decided": "Решил",
"decision": "Решение",
"DecisionSuccess": "Решил успешно!",
"disabled": "Отключен",
"disabledAt": "Отключено на",
"disabledBy": "Отключил(а)",

View File

@ -18,7 +18,7 @@
"generate:maintenance": "nuxt generate -c nuxt.config.maintenance.js",
"generate": "nuxt generate",
"lint": "eslint --ext .js,.vue .",
"locales": "../scripts/sort-translations.sh",
"locales": "../scripts/translations/missing-keys.sh && ../scripts/translations/sort.sh",
"precommit": "yarn lint",
"test": "jest",
"test:unit:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --no-cache --runInBand"