diff --git a/scripts/translations/missing-keys.sh b/scripts/translations/missing-keys.sh
index 105804900..aaeb1ac87 100755
--- a/scripts/translations/missing-keys.sh
+++ b/scripts/translations/missing-keys.sh
@@ -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
diff --git a/scripts/translations/sort.sh b/scripts/translations/sort.sh
index f2a5edebb..35496f27e 100755
--- a/scripts/translations/sort.sh
+++ b/scripts/translations/sort.sh
@@ -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
diff --git a/scripts/translations/sort_filter.jq b/scripts/translations/sort_filter.jq
new file mode 100644
index 000000000..9d108f8f0
--- /dev/null
+++ b/scripts/translations/sort_filter.jq
@@ -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)
\ No newline at end of file
diff --git a/webapp/locales/de.json b/webapp/locales/de.json
index b70227557..659eb624d 100644
--- a/webapp/locales/de.json
+++ b/webapp/locales/de.json
@@ -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 \"{name}\" wirklich gesperrt lassen?",
@@ -396,6 +397,7 @@
"title": "Entsperre den Beitrag abschließend"
}
},
+ "submit": "Bestätige Entscheidung",
"User": {
"disable": {
"message": "Möchtest du den Benutzer \"{name}\" wirklich gesperrt lassen?",
@@ -405,12 +407,10 @@
"message": "Möchtest du den Benutzer \"{name}\" wirklich entsperrt 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",
diff --git a/webapp/locales/en.json b/webapp/locales/en.json
index 8944985d4..fcc8004e6 100644
--- a/webapp/locales/en.json
+++ b/webapp/locales/en.json
@@ -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 \"{name}\" stay disabled?",
@@ -396,6 +397,7 @@
"title": "Finally Enable Post"
}
},
+ "submit": "Confirm decision",
"User": {
"disable": {
"message": "Do you really want to let the user \"{name}\" stay disabled?",
@@ -405,12 +407,10 @@
"message": "Do you really want to let the user \"{name}\" stay enabled?",
"title": "Finally Enable User"
}
- },
- "cancel": "Cancel",
- "submit": "Confirm decision"
+ }
},
- "decided": "Decided",
"decision": "Decision",
+ "DecisionSuccess": "Decided successfully!",
"disabled": "Disabled",
"disabledAt": "Disabled at",
"disabledBy": "Disabled by",
diff --git a/webapp/locales/es.json b/webapp/locales/es.json
index 177ca0a64..e4315734a 100644
--- a/webapp/locales/es.json
+++ b/webapp/locales/es.json
@@ -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 \"{nombre}\" permanezca desactivado?",
@@ -403,6 +404,7 @@
"title": "Finalmente Habilitar Contribución"
}
},
+ "submit": "Confirmar decisión",
"User": {
"disable": {
"message": "¿Realmente quiere que el usuario \"{nombre}\" permanezca desactivado?",
@@ -412,12 +414,10 @@
"message": "¿Realmente quiere que el usuario \"{nombre}\" permanezca habilitado?",
"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",
diff --git a/webapp/locales/fr.json b/webapp/locales/fr.json
index ce0febf46..fbe5477a7 100644
--- a/webapp/locales/fr.json
+++ b/webapp/locales/fr.json
@@ -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",
diff --git a/webapp/locales/it.json b/webapp/locales/it.json
index 1735f0e90..f387a114f 100644
--- a/webapp/locales/it.json
+++ b/webapp/locales/it.json
@@ -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",
diff --git a/webapp/locales/nl.json b/webapp/locales/nl.json
index 128c9db88..64643133c 100644
--- a/webapp/locales/nl.json
+++ b/webapp/locales/nl.json
@@ -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",
diff --git a/webapp/locales/pl.json b/webapp/locales/pl.json
index 3113e3f45..1d78ede01 100644
--- a/webapp/locales/pl.json
+++ b/webapp/locales/pl.json
@@ -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",
diff --git a/webapp/locales/pt.json b/webapp/locales/pt.json
index c6a6a17dd..5da36dfe9 100644
--- a/webapp/locales/pt.json
+++ b/webapp/locales/pt.json
@@ -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",
diff --git a/webapp/locales/ru.json b/webapp/locales/ru.json
index 1d3605db2..97eaff8f1 100644
--- a/webapp/locales/ru.json
+++ b/webapp/locales/ru.json
@@ -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": "Вы действительно хотите, чтобы комментарий \"{name}\" остановиться и отключен?",
@@ -403,6 +404,7 @@
"title": "Окончательно включить пост"
}
},
+ "submit": "Подтвердить решение",
"User": {
"disable": {
"message": "Вы действительно хотите, чтобы пользователь \"{name}\" остановиться и отключен?",
@@ -412,12 +414,10 @@
"message": "Вы уверены, что хотите поделиться пользователем \"{name}\"?",
"title": "Окончательно включить пост"
}
- },
- "cancel": "Отменить",
- "submit": "Подтвердить решение"
+ }
},
- "decided": "Решил",
"decision": "Решение",
+ "DecisionSuccess": "Решил успешно!",
"disabled": "Отключен",
"disabledAt": "Отключено на",
"disabledBy": "Отключил(а)",
diff --git a/webapp/package.json b/webapp/package.json
index 4ea5fd676..e29a90e50 100644
--- a/webapp/package.json
+++ b/webapp/package.json
@@ -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"