add ru locale to cli

This commit is contained in:
ars
2026-06-25 02:11:46 +03:00
parent 7963a8d2eb
commit 66b60b9bcb
9 changed files with 405 additions and 49 deletions
+27 -3
View File
@@ -1,4 +1,11 @@
.PHONY: all client server cli test clean
.PHONY: all client server cli test clean i18n-extract i18n-init i18n-update i18n-compile
# CLI localization (nexus-cli strings only; daemon/server logs stay in English).
LOCALE_DIR := src/nexus_sync/locale
POT := $(LOCALE_DIR)/nexus.pot
LANG ?= ru
# PyInstaller --add-data separator is ':' on Unix, ';' on Windows.
LOCALE_DATA := $(LOCALE_DIR):nexus_sync/locale
all: client server cli
@@ -8,8 +15,25 @@ client:
server:
pyinstaller --onefile src/nexus_sync/server/__main__.py --name nexus-sync-server
cli:
pyinstaller --onefile src/nexus_sync/cli/__main__.py --name nexus-cli
cli: i18n-compile
pyinstaller --onefile src/nexus_sync/cli/__main__.py --name nexus-cli \
--add-data "$(LOCALE_DATA)"
# Rebuild the message template from strings wrapped in _()/gettext()/ngettext().
i18n-extract:
pybabel extract -F babel.cfg -k _ -o $(POT) src
# Create a catalog for a new language, e.g. `make i18n-init LANG=de`.
i18n-init: i18n-extract
pybabel init -i $(POT) -d $(LOCALE_DIR) -D nexus -l $(LANG)
# Merge new/changed strings into existing catalogs.
i18n-update: i18n-extract
pybabel update -i $(POT) -d $(LOCALE_DIR) -D nexus
# Compile .po catalogs to the .mo files bundled with nexus-cli.
i18n-compile:
pybabel compile -d $(LOCALE_DIR) -D nexus
test:
pytest