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 #! /usr/bin/env bash
ROOT_DIR=$(dirname "$0")/../.. 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(\".\")'" 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 then
: # all good : # all good
else 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" printf "\nEnglish and German translation keys do not match, see diff above.\n"
exit 1 exit 1
fi fi

View File

@ -1,12 +1,12 @@
#! /usr/bin/env bash #! /usr/bin/env bash
ROOT_DIR=$(dirname "$0")/.. ROOT_DIR=$(dirname "$0")/../..
tmp=$(mktemp) tmp=$(mktemp)
exit_code=0 exit_code=0
for locale_file in $ROOT_DIR/webapp/locales/*.json for locale_file in $ROOT_DIR/webapp/locales/*.json
do do
jq --sort-keys . $locale_file > "$tmp" jq -f $(dirname "$0")/sort_filter.jq $locale_file > "$tmp"
if [ "$*" == "--fix" ] if [ "$*" == "--fix" ]
then then
mv "$tmp" $locale_file 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", "create": "Erstellen",
"delete": "Löschen", "delete": "Löschen",
"edit": "Bearbeiten", "edit": "Bearbeiten",
"loadMore": "mehr laden",
"loading": "wird geladen", "loading": "wird geladen",
"loadMore": "mehr laden",
"save": "Speichern" "save": "Speichern"
}, },
"admin": { "admin": {
@ -143,8 +143,8 @@
"category": "Kategorie ::: Kategorien", "category": "Kategorie ::: Kategorien",
"comment": "Kommentar ::: Kommentare", "comment": "Kommentar ::: Kommentare",
"letsTalk": "Miteinander reden", "letsTalk": "Miteinander reden",
"loadMore": "mehr laden",
"loading": "wird geladen", "loading": "wird geladen",
"loadMore": "mehr laden",
"moreInfo": "Mehr Info", "moreInfo": "Mehr Info",
"name": "Name", "name": "Name",
"organization": "Organisation ::: Organisationen", "organization": "Organisation ::: Organisationen",
@ -371,11 +371,12 @@
"moderation": { "moderation": {
"name": "Moderation", "name": "Moderation",
"reports": { "reports": {
"DecisionSuccess": "Erfolgreich entschieden!",
"author": "Autor", "author": "Autor",
"content": "Inhalt", "content": "Inhalt",
"decideButton": "Bestätige", "decideButton": "Bestätige",
"decided": "Entschieden",
"decideModal": { "decideModal": {
"cancel": "Abbruch",
"Comment": { "Comment": {
"disable": { "disable": {
"message": "Möchtest du den Kommentar \"<b>{name}</b>\" wirklich <b>gesperrt</b> lassen?", "message": "Möchtest du den Kommentar \"<b>{name}</b>\" wirklich <b>gesperrt</b> lassen?",
@ -396,6 +397,7 @@
"title": "Entsperre den Beitrag abschließend" "title": "Entsperre den Beitrag abschließend"
} }
}, },
"submit": "Bestätige Entscheidung",
"User": { "User": {
"disable": { "disable": {
"message": "Möchtest du den Benutzer \"<b>{name}</b>\" wirklich <b>gesperrt</b> lassen?", "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?", "message": "Möchtest du den Benutzer \"<b>{name}</b>\" wirklich <b>entsperrt</b> lassen?",
"title": "Entsperre den Benutzer abschließend" "title": "Entsperre den Benutzer abschließend"
} }
}
}, },
"cancel": "Abbruch",
"submit": "Bestätige Entscheidung"
},
"decided": "Entschieden",
"decision": "Entscheidung", "decision": "Entscheidung",
"DecisionSuccess": "Erfolgreich entschieden!",
"disabled": "Gesperrt", "disabled": "Gesperrt",
"disabledAt": "Gesperrt am", "disabledAt": "Gesperrt am",
"disabledBy": "Gesperrt von", "disabledBy": "Gesperrt von",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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