diff --git a/configure.ac b/configure.ac index 22525dfb98..f9b376e14f 100644 --- a/configure.ac +++ b/configure.ac @@ -1558,6 +1558,12 @@ dnl installing these features or not. dnl Note: more for tests than other reasons, there is also an option dnl value to "force" the installation. +dnl The gettext "msgfmt" tool (or equivalent) can be used to maintain +dnl human-language text translations. Currently this is used specifically +dnl in the Python NUT-Monitor app sources (*.po => *.mo conversions). +AC_PATH_PROGS([MSGFMT], [msgfmt], [none]) +AM_CONDITIONAL([HAVE_MSGFMT], [test "x${MSGFMT}" != "xnone"]) + dnl ---------------------------------------------------------------------- dnl checks related to --with-serial diff --git a/docs/config-prereqs.txt b/docs/config-prereqs.txt index 43d33802f9..51f3b84c77 100644 --- a/docs/config-prereqs.txt +++ b/docs/config-prereqs.txt @@ -141,6 +141,15 @@ metadata about recently published package revisions: # :; apt-get install python3 python3.9 # You can find a list of what is (pre-)installed with: # :; dpkg -l | grep -Ei 'perl|python' +# +# For localization maintenance (currently in Python NUT-Monitor app), +# provide an `msgfmt` implementation, e.g.: +# :; apt-get install gettext +# +# To install the Python NUT-Monitor app, you may need some modules: +# :; apt-get install pip +# For Python3: +# :; pip install PyQt5 configparser # For spell-checking, highly recommended if you would propose pull requests: :; apt-get install \ diff --git a/scripts/python/Makefile.am b/scripts/python/Makefile.am index 542989d82c..dfbedca182 100644 --- a/scripts/python/Makefile.am +++ b/scripts/python/Makefile.am @@ -24,6 +24,10 @@ PYTHON3_SITE_PACKAGES = @PYTHON3_SITE_PACKAGES@ BINDIR = @BINDIR@ +if HAVE_MSGFMT +MSGFMT = @MSGFMT@ +endif HAVE_MSGFMT + NUT_MONITOR_PY2GTK2 = \ app/ui/gui-1.3.glade \ app/nut-monitor-py2gtk2.desktop @@ -71,7 +75,7 @@ PYNUT_COMMON = \ module/README # Note: we both distribute and install the generated *.mo translation files -# so they are listed above and not in NUT_MONITOR_COMMON_GENERATED +# so they are listed above and not in NUT_MONITOR_COMMON_TEMPLATE NUT_MONITOR_COMMON_TEMPLATE = \ app/locale/NUT-Monitor.pot \ app/locale/fr/fr.po \ @@ -113,6 +117,17 @@ nutmonitordir = $(nut_with_nut_monitor_dir) nobase_nutmonitor_DATA = $(NUT_MONITOR_DISPATCHER_NOEXEC) $(NUT_MONITOR_COMMON) nobase_nutmonitor_SCRIPTS = $(NUT_MONITOR_DISPATCHER_SCRIPT) +if HAVE_MSGFMT +app/locale/fr/LC_MESSAGES/NUT-Monitor.mo: app/locale/fr/fr.po + $(MSGFMT) -c "$<" -o "$@" + +app/locale/it/LC_MESSAGES/NUT-Monitor.mo: app/locale/it/it.po + $(MSGFMT) -c "$<" -o "$@" + +app/locale/ru/LC_MESSAGES/NUT-Monitor.mo: app/locale/ru/ru.po + $(MSGFMT) -c "$<" -o "$@" +endif HAVE_MSGFMT + if WITH_NUT_MONITOR_PY2GTK2 nobase_nutmonitor_DATA += $(NUT_MONITOR_PY2GTK2) nobase_nutmonitor_SCRIPTS += $(NUT_MONITOR_PY2GTK2_GENERATED_SCRIPT)