From 946c8d7cfd2fade5e6f2107e963df76e25ef35d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Brzozowski?= Date: Thu, 14 Sep 2023 21:34:43 +0200 Subject: [PATCH] [strings] Updated category consistency checker and documented it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MichaƂ Brzozowski --- docs/TRANSLATIONS.md | 5 +++++ tools/ruby/category_consistency/omim_parsers.rb | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/TRANSLATIONS.md b/docs/TRANSLATIONS.md index 70f190fa55..0bcb6fa42c 100644 --- a/docs/TRANSLATIONS.md +++ b/docs/TRANSLATIONS.md @@ -49,6 +49,11 @@ By default, it searches `strings.txt`, to check `types_strings.txt` add a `-t` o There are many more other options, e.g. print various translation statistics, validate and re-format translation files. Check `tools/python/strings_utils.py -h` to see all of them. +To check consistency of types_strings.txt with categories.txt run: +``` +ruby tools/ruby/category_consistency/check_consistency.rb +``` + ## Automatic translations In some cases automatically translated strings are better than no translation at all. diff --git a/tools/ruby/category_consistency/omim_parsers.rb b/tools/ruby/category_consistency/omim_parsers.rb index 8c55cb99cc..440946524b 100644 --- a/tools/ruby/category_consistency/omim_parsers.rb +++ b/tools/ruby/category_consistency/omim_parsers.rb @@ -1,6 +1,11 @@ module OmimParsers - LANGUAGES = %w(en ru ar cs da nl fi fr de hu id it ja ko nb pl - pt ro es sv th tr uk vi zh-Hans zh-Hant he sk) + + # To update the list, run in root directory: + # sed -nEe "s/ +([a-zA-Z]{2}(-[a-zA-Z]{2,})?) = .*$/\1/p" "data/strings/strings.txt" | sort -u | tr '\n' ' ' | sed -e 's/,$//' | fold -s -w48; echo + LANGUAGES = %w(af ar be bg ca cs da de el en en-GB es es-MX et + eu fa fi fr fr-CA he hi hu id it ja ko lt mr nb + nl pl pt pt-BR ro ru sk sv sw th tr uk vi + zh-Hans zh-Hant) class AbstractParser def initialize(keys)