Skip to content

Commit

Permalink
scripts/python/Makefile.am, configure.ac, docs/config-prereqs.txt: us…
Browse files Browse the repository at this point in the history
…e gettext msgfmt to compile binary translation files
  • Loading branch information
jimklimov committed Jun 30, 2023
1 parent 1d73aac commit 66da572
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
6 changes: 6 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions docs/config-prereqs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
17 changes: 16 additions & 1 deletion scripts/python/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 66da572

Please sign in to comment.