i18n: translate all strings

This commit is contained in:
Maxim Slipenko 2025-02-27 11:43:20 +03:00
parent 4e6e1f524a
commit dcac0b9ee5
4 changed files with 42 additions and 37 deletions

@ -6,13 +6,13 @@
</mask> </mask>
<g mask="url(#round)"> <g mask="url(#round)">
<rect width="75" height="20" fill="#555"/> <rect width="75" height="20" fill="#555"/>
<rect x="75" width="64" height="20" fill="#dfb317"/> <rect x="75" width="64" height="20" fill="#4c1"/>
<rect width="129" height="20" fill="url(#smooth)"/> <rect width="129" height="20" fill="url(#smooth)"/>
</g> </g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"> <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="37" y="15" fill="#010101" fill-opacity=".3">ru translate</text> <text x="37" y="15" fill="#010101" fill-opacity=".3">ru translate</text>
<text x="37" y="14">ru translate</text> <text x="37" y="14">ru translate</text>
<text x="100" y="15" fill="#010101" fill-opacity=".3">79.00%</text> <text x="100" y="15" fill="#010101" fill-opacity=".3">100.00%</text>
<text x="100" y="14">79.00%</text> <text x="100" y="14">100.00%</text>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 943 B

After

Width:  |  Height:  |  Size: 942 B

@ -46,7 +46,7 @@ func InstallCmd() *cli.Command {
&cli.BoolFlag{ &cli.BoolFlag{
Name: "clean", Name: "clean",
Aliases: []string{"c"}, Aliases: []string{"c"},
Usage: "Build package from scratch even if there's an already built package available", Usage: gotext.Get("Build package from scratch even if there's an already built package available"),
}, },
}, },
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {

@ -5,7 +5,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: unnamed project\n" "Project-Id-Version: unnamed project\n"
"PO-Revision-Date: 2025-02-27 10:10+0300\n" "PO-Revision-Date: 2025-02-27 11:33+0300\n"
"Last-Translator: Maxim Slipenko <maks1ms@alt-gnome.ru>\n" "Last-Translator: Maxim Slipenko <maks1ms@alt-gnome.ru>\n"
"Language-Team: Russian\n" "Language-Team: Russian\n"
"Language: ru\n" "Language: ru\n"
@ -26,7 +26,7 @@ msgstr "Путь к скрипту сборки"
#: build.go:55 #: build.go:55
msgid "Specify package in script (for multi package script only)" msgid "Specify package in script (for multi package script only)"
msgstr "" msgstr "Укажите пакет в скрипте (только для многопакетного скрипта)"
#: build.go:60 #: build.go:60
msgid "Name of the package to build and its repo (example: default/go-bin)" msgid "Name of the package to build and its repo (example: default/go-bin)"
@ -43,7 +43,7 @@ msgstr "Ошибка инициализации базы данных"
#: build.go:105 #: build.go:105
msgid "Package not found" msgid "Package not found"
msgstr "" msgstr "Пакет не найден"
#: build.go:123 #: build.go:123
msgid "Error pulling repositories" msgid "Error pulling repositories"
@ -54,7 +54,6 @@ msgid "Unable to detect a supported package manager on the system"
msgstr "Не удалось обнаружить поддерживаемый менеджер пакетов в системе" msgstr "Не удалось обнаружить поддерживаемый менеджер пакетов в системе"
#: build.go:137 #: build.go:137
#, fuzzy
msgid "Error parsing os release" msgid "Error parsing os release"
msgstr "Ошибка при разборе файла выпуска операционной системы" msgstr "Ошибка при разборе файла выпуска операционной системы"
@ -220,35 +219,35 @@ msgstr "ОПИСАНИЕ"
#: internal/cliutils/template.go:74 #: internal/cliutils/template.go:74
msgid "AUTHOR" msgid "AUTHOR"
msgstr "" msgstr "АВТОР"
#: internal/cliutils/template.go:74 #: internal/cliutils/template.go:74
msgid "COMMANDS" msgid "COMMANDS"
msgstr "" msgstr "КОМАНДЫ"
#: internal/cliutils/template.go:74 #: internal/cliutils/template.go:74
msgid "GLOBAL OPTIONS" msgid "GLOBAL OPTIONS"
msgstr "" msgstr "ГЛОБАЛЬНЫЕ ОПЦИИ"
#: internal/cliutils/template.go:74 #: internal/cliutils/template.go:74
msgid "COPYRIGHT" msgid "COPYRIGHT"
msgstr "" msgstr "АВТОРСКОЕ ПРАВО"
#: internal/cliutils/template.go:95 #: internal/cliutils/template.go:95
msgid "command options" msgid "command options"
msgstr "" msgstr "опции команды"
#: internal/cliutils/template.go:96 #: internal/cliutils/template.go:96
msgid "arguments..." msgid "arguments..."
msgstr "" msgstr "аргументы..."
#: internal/cliutils/template.go:97 #: internal/cliutils/template.go:97
msgid "CATEGORY" msgid "CATEGORY"
msgstr "" msgstr "КАТЕГОРИЯ"
#: internal/cliutils/template.go:99 internal/cliutils/template.go:100 #: internal/cliutils/template.go:99 internal/cliutils/template.go:100
msgid "OPTIONS" msgid "OPTIONS"
msgstr "" msgstr "ПАРАМЕТРЫ"
#: internal/config/config.go:59 #: internal/config/config.go:59
msgid "Error opening config file, using defaults" msgid "Error opening config file, using defaults"
@ -318,11 +317,11 @@ msgstr "Скачивание источника"
#: internal/dl/progress_tui.go:100 #: internal/dl/progress_tui.go:100
msgid "%s: done!\n" msgid "%s: done!\n"
msgstr "" msgstr "%s: выполнено!\n"
#: internal/dl/progress_tui.go:104 #: internal/dl/progress_tui.go:104
msgid "%s %s downloading at %s/s\n" msgid "%s %s downloading at %s/s\n"
msgstr "" msgstr "%s %s загружается — %s/с\n"
#: internal/logger/log.go:47 #: internal/logger/log.go:47
msgid "ERROR" msgid "ERROR"
@ -358,7 +357,7 @@ msgstr ""
#: main.go:125 #: main.go:125
msgid "Show help" msgid "Show help"
msgstr "" msgstr "Показать справку"
#: main.go:129 #: main.go:129
msgid "Error while running app" msgid "Error while running app"
@ -421,9 +420,8 @@ msgid "Executing build()"
msgstr "Исполнение build()" msgstr "Исполнение build()"
#: pkg/build/build.go:689 pkg/build/build.go:709 #: pkg/build/build.go:689 pkg/build/build.go:709
#, fuzzy
msgid "Executing %s()" msgid "Executing %s()"
msgstr "Исполнение files()" msgstr "Исполнение %s()"
#: pkg/build/build.go:768 #: pkg/build/build.go:768
msgid "Error installing native packages" msgid "Error installing native packages"
@ -521,38 +519,35 @@ msgstr "Скачать все изменённые репозитории"
#: search.go:36 #: search.go:36
msgid "Search packages" msgid "Search packages"
msgstr "" msgstr "Поиск пакетов"
#: search.go:42 #: search.go:42
msgid "Search by name" msgid "Search by name"
msgstr "" msgstr "Искать по имени"
#: search.go:47 #: search.go:47
msgid "Search by description" msgid "Search by description"
msgstr "" msgstr "Искать по описанию"
#: search.go:52 #: search.go:52
#, fuzzy
msgid "Search by repository" msgid "Search by repository"
msgstr "Добавить новый репозиторий" msgstr "Искать по репозиторию"
#: search.go:57 #: search.go:57
msgid "Search by provides" msgid "Search by provides"
msgstr "" msgstr "Иcкать по provides"
#: search.go:62 #: search.go:62
msgid "Format output using a Go template" msgid "Format output using a Go template"
msgstr "" msgstr "Формат выходных данных с использованием шаблона Go"
#: search.go:82 search.go:99 #: search.go:82 search.go:99
#, fuzzy
msgid "Error parsing format template" msgid "Error parsing format template"
msgstr "Ошибка при разборе файла выпуска операционной системы" msgstr "Ошибка при разборе шаблона"
#: search.go:107 #: search.go:107
#, fuzzy
msgid "Error executing template" msgid "Error executing template"
msgstr "Ошибка при получении пакетов" msgstr "Ошибка при выполнении шаблона"
#: upgrade.go:47 #: upgrade.go:47
msgid "Upgrade all installed packages" msgid "Upgrade all installed packages"

@ -19,7 +19,7 @@
TRANSLATIONS_DIR="internal/translations/po" TRANSLATIONS_DIR="internal/translations/po"
if [ ! -d "$TRANSLATIONS_DIR" ]; then if [ ! -d "$TRANSLATIONS_DIR" ]; then
echo "Ошибка: директория '$TRANSLATIONS_DIR' не найдена" echo "Error: directory '$TRANSLATIONS_DIR' not found"
exit 1 exit 1
fi fi
@ -29,10 +29,20 @@ declare -A TRANSLATED_STRINGS_MAP
for PO_FILE in $(find "$TRANSLATIONS_DIR" -type f -name "*.po"); do for PO_FILE in $(find "$TRANSLATIONS_DIR" -type f -name "*.po"); do
LANG_DIR=$(dirname "$PO_FILE") LANG_DIR=$(dirname "$PO_FILE")
LANG=$(basename "$LANG_DIR") LANG=$(basename "$LANG_DIR")
TOTAL_STRINGS=$(grep -c "^msgid " "$PO_FILE") STATS=$(LC_ALL=C msgfmt --statistics -o /dev/null "$PO_FILE" 2>&1)
TRANSLATED_STRINGS=$(grep -c "^msgstr \"[^\"]\+\"" "$PO_FILE")
NUMBERS=($(echo "$STATS" | grep -o '[0-9]\+'))
case ${#NUMBERS[@]} in
1) TRANSLATED_STRINGS=${NUMBERS[0]}; UNTRANSLATED_STRINGS=0 ;; # all translated
2) TRANSLATED_STRINGS=${NUMBERS[0]}; UNTRANSLATED_STRINGS=${NUMBERS[1]} ;; # no fuzzy
3) TRANSLATED_STRINGS=${NUMBERS[0]}; UNTRANSLATED_STRINGS=${NUMBERS[2]} ;; # with fuzzy
*) TRANSLATED_STRINGS=0; UNTRANSLATED_STRINGS=0 ;;
esac
TOTAL_STRINGS=$((TRANSLATED_STRINGS + UNTRANSLATED_STRINGS))
TOTAL_STRINGS_MAP[$LANG]=$((TOTAL_STRINGS_MAP[$LANG] + TOTAL_STRINGS)) TOTAL_STRINGS_MAP[$LANG]=$((TOTAL_STRINGS_MAP[$LANG] + TOTAL_STRINGS))
TRANSLATED_STRINGS_MAP[$LANG]=$((TRANSLATED_STRINGS_MAP[$LANG] + TRANSLATED_STRINGS)) TRANSLATED_STRINGS_MAP[$LANG]=$((TRANSLATED_STRINGS_MAP[$LANG] + TRANSLATED_STRINGS))
done done