This allows us to "build" .po and .pot files for HylaFAX.
It builds 3 sets:
libhylafax Strings used in libhylafax
hylafax-client Strings used in hylafax client components
hylafax-server Strings used in hylafax server components
All are merged to one master "hylafax.pot" for translating. The 3
separate catalogs translations are merged out of the master
hylafax.pot/$LANG.po to build the .mo for installation.
Makefile hackery makes me which we only supported "real" makes...
rules
.project
.settings
+messages.po
SRCDIR = ${TOPSRCDIR}/${DEPTH}
-DIRS= libhylafax \
+DSODIRS = libhylafax
+
+SRCDIRS = ${DSODIRS} \
util \
faxalter \
faxcover \
faxstat \
hfaxd \
sendfax \
- sendpage \
- \
+ sendpage
+
+DIRS= ${SRCDIRS} \
config \
etc \
man
-DSODIRS = libhylafax
-
TARGETS=hylafax
default all ${TARGETS}:
else \
true; \
fi
+ @if [ "@NLS@" = yes ]; then \
+ ${ECHO} "= "po; cd po; ${MAKE} || exit $?; \
+ else \
+ true; \
+ fi
@${ECHO} "= "pkg; cd pkg; ${MAKE} || exit $?
depend::
@if [ "@PORT@" = yes ]; then \
(cd pkg; ${MAKE} distclean)
-${RM} -f defs rules Makefile
+update-po::
+ @if [ "@NLS@" != yes ]; then \
+ echo "NLS Not enabled"; false; \
+ fi
+ @for i in ${SRCDIRS}; do \
+ (${ECHO} "= "$$i; cd $$i; ${MAKE} messages.po); \
+ done
+ (cd po; ${MAKE} hylafax.pot)
+
makeClientDirs::
-${INSTALL} -u ${SYSUSER} -g ${SYSGROUP} -m ${DIRMODE} \
-idb hylafax.sw.client -dir \
else \
true; \
fi
+ @if [ "@NLS@" = yes ]; then \
+ ${ECHO} "= po"; cd po; ${MAKE} install || exit 1; \
+ else \
+ true; \
+ fi
CLIENTDIRS=\
faxalter \
else \
true; \
fi
+ @if [ "@NLS@" = yes ]; then \
+ (${ECHO} "= po"; cd po; ${MAKE} installClient || exit 1; \
+ else \
+ true; \
+ fi
package::
@${ECHO} "= "pkg; cd pkg; ${MAKE} package
GS=no
IMP=no
UTMP=auto
+NLS=auto
OPTIMIZER="-O"
LIBTIFF="-L/usr/local/lib -ltiff"
TIFFINC=/usr/local/include
LLDOPTS
LN
LN_S
-LOCALEDIR DIR_LOCALE
+LOCALEDIR DIR_LOCALE
LOCALE_DOMAIN
HAVE_PAM
PAMLIBS
MKFIFO
MV
MV_F
+NLS
NOCLOBBER_OFF
NOCLOBBER_ON
OPTIMIZER
CheckForIncludeFile locale.h &&
CheckForIncludeFile libintl.h && {
ENABLE_NLS="#define ENABLE_NLS 1"
+ NLS='yes'
CheckForLibraryWithArgs gettext '""' -lc || {
CheckForLibraryWithArgs gettext '""' -lintl && {
Note "Looks like -lintl is needed for gettext support."
$MKDIR $dir
fi
suffix=`echo $F | $SED 's/.*\.//'`
- if [ "$suffix" = h ]; then
+ if [ "$suffix" = h ] || [ "$suffix" = po ]; then
#
# Compare old and new versions so that include files
# are only updated when something has changed--this
sendfax/Makefile
sendpage/Makefile
util/Makefile
+ po/Makefile
+
+ po/version.po
port/install.sh
test $PORT = yes && SedConfigFiles port/Makefile
test $REGEX = yes && SedConfigFiles regex/Makefile
test $DBLIB = yes && SedConfigFiles dblib/Makefile
+test $NLS = yes && SedConfigFiles po/Makefile
test -f $SRCDIR/MLA/VERSION && SedConfigFiles MLA/Makefile
if [ "$MAKEDEPINCLUDE" != "sinclude" ]; then
test $PORT = yes && DEPEND="$DEPEND port"
test $REGEX = yes && DEPEND="$DEPEND regex"
test $DBLIB = yes && DEPEND="$DEPEND dblib"
+ test $NLS = yes && DEPEND="$DEPEND po"
test -f $SRCDIR/MLA/VERSION && DEPEND="$DEPEND MLA"
test -d $SRCDIR/faxview && test -d faxview && DEPEND="$DEPEND faxview"
for i in $DEPEND; do
MANCFILENAME = @MANCFILENAME@
MANSAPPNAME = @MANSAPPNAME@
MANSFILENAME = @MANSFILENAME@
+#
+# NLS Support
+#
+# All translations listed here must have a translated po/${LANG}.po file
+#
+LOCALEDIR = @LOCALEDIR@
+
+LANGUAGES =
+
+XGETTEXT = xgettext --foreign-user -ctranslator --no-wrap --sort-by-file --omit-header --strict --indent --force-po
+MSGMERGE = msgmerge --no-wrap --sort-by-file --no-wrap
+MSGFMT = msgfmt
+MSGCAT = msgcat
TARGETS=libhylafax-${ABI_VERSION}.${DSO}
+GETTEXT_TRIGGERS = TEXT
+
default all::
@${MAKE} incdepend
@${MAKE} targets
--- /dev/null
+# Common rules for Native Language Support (NLS)
+# #
+# # If some subdirectory of the source tree wants to provide NLS, it
+# # needs to define the following make variable assignments:
+# #
+# # SOURCES -- list of source files that contain message strings
+# # GETTEXT_TRIGGERS -- (optional) list of functions that contain
+# # translatable strings
+# #
+# # That's all. This will allow a "message.po" to be build there, and
+# # the infrastructue in po/Makefile will use this to update everything
+
+nls-SHOUT:
+ @echo "NLS Settings:"
+ @echo "PO: '${PO_FILES}'"
+ @echo "MO: '${MO_FILES}'"
+ @echo "FILES: ${SOURCES}"
+
+messages.po: ${SOURCES}
+ ${XGETTEXT} -D ${SRCDIR} -n ${addprefix -k, _ ${GETTEXT_TRIGGERS}} ${SOURCES}
--- /dev/null
+
+#
+# VERSION: @VERSION@
+# DATE: @DATE@
+# TARGET: @TARGET@
+# CCOMPILER: @CCOMPILER@
+# CXXCOMPILER: @CXXCOMPILER@
+#
+DEPTH=..
+@MAKEINCLUDE@ @MAKELQUOTE@${DEPTH}/defs@MAKERQUOTE@
+
+LIBVERSION = @VERSION@
+SRCDIR = ${DEPTH}/${TOPSRCDIR}/po
+VPATH = ../@SRCDIR@/po
+
+TARGETS=all-mo
+
+default all::
+ @${MAKE} targets
+
+targets: $(TARGETS)
+
+@MAKEINCLUDE@ @MAKELQUOTE@${COMMONRULES}@MAKERQUOTE@
+
+
+CLIENTS = faxalter faxrm faxstat sendfax sendpage
+
+SERVERS = util
+installClient:
+
+install:
+
+
+@MAKEINCLUDE@ @MAKELQUOTE@${SRCDIR}/nls.mk@MAKERQUOTE@
--- /dev/null
+#
+# We build the language .po/.mo files with all makes
+#
+# Unfortunately, only real makes (i.e. GNU make) no khow to rebuild
+# the raw .po files properly, but that's not a big problem
+hylafax.pot: version.po libhylafax/messages.pot hylafax-client/messages.pot hylafax-server/messages.pot
+ cat version.po > $@.tmp
+ ${MSGCAT} libhylafax/messages.pot hylafax-client/messages.pot hylafax-server/messages.pot >> $@.tmp
+ mv $@.tmp $@
+
+
+# A bit more trikery here
+# We want $(wildcard...) because we don't want to try to "rebuild" thes messages.pot
+# unless the components exist. If update-po was run, they should all exist
+# But legacy makes (SCO) don't support $(wildcard...). Luckly, they don't support $(...)
+# At all, so they just drop it all. Real makes support $(wildcard)
+# That's why we use the $(...${...})
+libhylafax/messages.pot: $(wildcard ${patsubst %, ${DEPTH}/%/messages.po, libhylafax})
+ test -d libhylafax || mkdir libhylafax
+ ${MSGCAT} $^ > $@.tmp
+ mv $@.tmp $@
+
+hylafax-client/messages.pot: $(wildcard ${patsubst %, ${DEPTH}/%/messages.po, ${CLIENTS}})
+ test -d hylafax-client || mkdir hylafax-client
+ ${MSGCAT} $^ > $@.tmp
+ mv $@.tmp $@
+
+
+hylafax-server/messages.pot: $(wildcard ${patsubst %, ${DEPTH}/%/messages.po, ${SERVERS}})
+ test -d hylafax-server || mkdir hylafax-server
+ ${MSGCAT} $^ > $@.tmp
+ mv $@.tmp $@
+
+# We can't use any normal Make pattern rules while we're stuck supporting
+# legacy comiples like SCO, so be carefull!
+# Here again (like MANCVT) we can't use $<, because we're not an "inferred" rule
+# So techincally, this rule's depencies aren't *quite* complete, but on well
+${CATALOG}/${LANGUAGE}.po: ${CATALOG}/messages.pot
+ test -d ${CATALOG} || mkdir ${CATALOG}
+ touch $@.tmp
+ ${MSGMERGE} $@.tmp $? -o $@ --compendium=${SRCDIR}/${LANGUAGE}.po
+ rm -f $@.tmp
+
+${CATALOG}/${LANGUAGE}.mo: ${CATALOG}/${LANGUAGE}.po
+ ${MSGFMT} -o $@ $?
+
+lang-mo: ${CATALOG}/${LANGUAGE}.mo
+
+#and since we don't have pattern rules, we do this horrid loop
+all-mo:
+ @for l in ${LANGUAGES}; do \
+ for c in libhylafax hylafax-client hylafax-server; do \
+ ${MAKE} LANGUAGE=$$l CATALOG=$$c lang-mo || exit $?; \
+ done; \
+ done
--- /dev/null
+# HylaFAX PO TEMPLATE
+# This file is distrubuted under the same license as the HylaFAX package.
+#, fuzy
+msgid ""
+msgstr ""
+"Project-Id-Version: HylaFAX @VERSION@\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"PO-Revision-Date: @DATE@\n"
#
RAWDEPFILTER= sed -e 's:^:${VPATH}/:'
+#include NLS stuff
+@MAKEINCLUDE@ @MAKELQUOTE@${DEPTH}/${TOPSRCDIR}/nls-rules.mk@MAKERQUOTE@
+
#
# Include the make dependency file if it exists.
#
targets: $(TARGETS)
+CFILES = faxadduser.c \
+ faxconfig.c \
+ faxdeluser.c \
+ faxmodem.c \
+ faxmsg.c \
+ faxstate.c
+
+C++FILES=checkat.c++ \
+ dialtest.c++ \
+ faxfetch.c++ \
+ faxinfo.c++ \
+ faxwatch.c++ \
+ textfmt.c++ \
+ tiffcheck.c++ \
+ typetest.c++
+
@MAKEINCLUDE@ @MAKELQUOTE@${COMMONRULES}@MAKERQUOTE@
faxmsg: ${SRCDIR}/faxmsg.c ${LIBS}