Files
nexus-sync/Makefile
T
2026-06-25 02:11:46 +03:00

43 lines
1.3 KiB
Makefile

.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
client:
pyinstaller --onefile src/nexus_sync/client/__main__.py --name nexus-sync-client
server:
pyinstaller --onefile src/nexus_sync/server/__main__.py --name nexus-sync-server
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
clean:
rm -rf build dist *.spec