From: Arkadiusz Miśkiewicz Date: Thu, 29 Jan 2009 22:24:45 +0000 (+0100) Subject: gettext: make build system look more like automake gettext X-Git-Tag: v3.0.0~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8c053393e88f94fe08db43757b97779b5c4908bd;p=thirdparty%2Fxfsprogs-dev.git gettext: make build system look more like automake gettext configure.in: Find all *.c files using find so no need to update po/Makefile manually (previous method leads to problems like when someone adds new .c file and forgets to update Makefile - then translations are removed after update). po/Makefile: Use automaticly found .c files. Add update-po target. Show translation statistics when processing po files. Turn on msgfmt validation (-c). How to update translations now? $ ./configure $ cd po; make update-po $ vim your.po $ make Signed-off-by: Arkadiusz Miśkiewicz Reviewed-by: Christoph Hellwig --- diff --git a/configure.in b/configure.in index 6bd24215d..4e4e50c74 100644 --- a/configure.in +++ b/configure.in @@ -35,6 +35,13 @@ AC_ARG_ENABLE(lib64, enable_lib64=no) AC_SUBST(enable_lib64) +# Find localized files +LOCALIZED_FILES="" +for lfile in `find ${srcdir} -name '*.c' -type f || exit 1`; do + LOCALIZED_FILES="$LOCALIZED_FILES \$(TOPDIR)/$lfile" +done +AC_SUBST(LOCALIZED_FILES) + AC_PACKAGE_GLOBALS(xfsprogs) AC_PACKAGE_UTILITIES(xfsprogs) AC_MULTILIB($enable_lib64) diff --git a/include/builddefs.in b/include/builddefs.in index f07d8d648..49e272246 100644 --- a/include/builddefs.in +++ b/include/builddefs.in @@ -74,6 +74,7 @@ MAKEDEPEND = @makedepend@ MSGFMT = @msgfmt@ MSGMERGE = @msgmerge@ XGETTEXT = @xgettext@ +LOCALIZED_FILES = @LOCALIZED_FILES@ RPM = @rpm@ RPMBUILD = @rpmbuild@ diff --git a/include/buildrules b/include/buildrules index 1047ec339..f2a337272 100644 --- a/include/buildrules +++ b/include/buildrules @@ -42,14 +42,24 @@ ifdef POTHEAD $(POTHEAD): $(XGETTEXTFILES) $(XGETTEXT) --language=C --keyword=_ --keyword=N_ -o $@ $(XGETTEXTFILES) -# Generate temp .po files, to check whether translations need updating. -# Not by default, due to gettext output differences between versions. -%.po: $(POTHEAD) -# $(MSGMERGE) -o $@.tmpo $@ $(POTHEAD) -# if ! diff $@.tmpo $@ >/dev/null; then echo "$@ dated, see $@.tmpo"; fi +# Update translations +update-po: $(POTHEAD) $(wildcard $(TOPDIR)/po/*.po) + catalogs=$(wildcard $(TOPDIR)/po/*.po); \ + for cat in $$catalogs; do \ + lang=`basename $$cat .po`; \ + mv $$lang.po $$lang.old.po; \ + echo "$$lang:"; \ + if $(MSGMERGE) $$lang.old.po $(POTHEAD) -o $$lang.po; then \ + rm -f $$lang.old.po; \ + else \ + echo "msgmerge for $$lang failed!"; \ + rm -f $$lang.po; \ + mv $$lang.old.po $$lang.po; \ + fi; \ + done %.mo: %.po - $(MSGFMT) -o $@ $< + $(MSGFMT) -c --statistics -o $@ $< endif source : diff --git a/po/Makefile b/po/Makefile index c6ccf6058..ac7d43ff7 100644 --- a/po/Makefile +++ b/po/Makefile @@ -10,97 +10,7 @@ LINGUAS = pl LSRCFILES = $(LINGUAS:%=%.po) $(POTHEAD) LDIRT = $(POTHEAD) -# TODO: db/ logprint/ -XGETTEXTFILES = \ - $(TOPDIR)/copy/xfs_copy.c \ - $(TOPDIR)/estimate/xfs_estimate.c \ - $(TOPDIR)/growfs/xfs_growfs.c \ - $(TOPDIR)/io/attr.c \ - $(TOPDIR)/io/bmap.c \ - $(TOPDIR)/io/fadvise.c \ - $(TOPDIR)/io/file.c \ - $(TOPDIR)/io/freeze.c \ - $(TOPDIR)/io/fsync.c \ - $(TOPDIR)/io/getrusage.c \ - $(TOPDIR)/io/imap.c \ - $(TOPDIR)/io/init.c \ - $(TOPDIR)/io/inject.c \ - $(TOPDIR)/io/madvise.c \ - $(TOPDIR)/io/mincore.c \ - $(TOPDIR)/io/mmap.c \ - $(TOPDIR)/io/open.c \ - $(TOPDIR)/io/parent.c \ - $(TOPDIR)/io/pread.c \ - $(TOPDIR)/io/prealloc.c \ - $(TOPDIR)/io/pwrite.c \ - $(TOPDIR)/io/resblks.c \ - $(TOPDIR)/io/sendfile.c \ - $(TOPDIR)/io/shutdown.c \ - $(TOPDIR)/io/truncate.c \ - $(TOPDIR)/libdisk/dm.c \ - $(TOPDIR)/libdisk/drivers.c \ - $(TOPDIR)/libdisk/evms.c \ - $(TOPDIR)/libdisk/fstype.c \ - $(TOPDIR)/libdisk/lvm.c \ - $(TOPDIR)/libdisk/md.c \ - $(TOPDIR)/libdisk/pttype.c \ - $(TOPDIR)/libdisk/xvm.c \ - $(TOPDIR)/libxcmd/command.c \ - $(TOPDIR)/libxcmd/help.c \ - $(TOPDIR)/libxcmd/input.c \ - $(TOPDIR)/libxcmd/paths.c \ - $(TOPDIR)/libxcmd/projects.c \ - $(TOPDIR)/libxcmd/quit.c \ - $(TOPDIR)/libxfs/darwin.c \ - $(TOPDIR)/libxfs/freebsd.c \ - $(TOPDIR)/libxfs/init.c \ - $(TOPDIR)/libxfs/irix.c \ - $(TOPDIR)/libxfs/linux.c \ - $(TOPDIR)/libxfs/rdwr.c \ - $(TOPDIR)/libxfs/trans.c \ - $(TOPDIR)/libxfs/util.c \ - $(TOPDIR)/libxlog/util.c \ - $(TOPDIR)/mkfs/proto.c \ - $(TOPDIR)/mkfs/xfs_mkfs.c \ - $(TOPDIR)/quota/edit.c \ - $(TOPDIR)/quota/free.c \ - $(TOPDIR)/quota/init.c \ - $(TOPDIR)/quota/path.c \ - $(TOPDIR)/quota/project.c \ - $(TOPDIR)/quota/quot.c \ - $(TOPDIR)/quota/quota.c \ - $(TOPDIR)/quota/report.c \ - $(TOPDIR)/quota/state.c \ - $(TOPDIR)/quota/util.c \ - $(TOPDIR)/repair/agheader.c \ - $(TOPDIR)/repair/attr_repair.c \ - $(TOPDIR)/repair/avl.c \ - $(TOPDIR)/repair/avl64.c \ - $(TOPDIR)/repair/bmap.c \ - $(TOPDIR)/repair/dino_chunks.c \ - $(TOPDIR)/repair/dinode.c \ - $(TOPDIR)/repair/dir.c \ - $(TOPDIR)/repair/dir2.c \ - $(TOPDIR)/repair/incore.c \ - $(TOPDIR)/repair/incore_ext.c \ - $(TOPDIR)/repair/incore_ino.c \ - $(TOPDIR)/repair/init.c \ - $(TOPDIR)/repair/phase1.c \ - $(TOPDIR)/repair/phase2.c \ - $(TOPDIR)/repair/phase3.c \ - $(TOPDIR)/repair/phase4.c \ - $(TOPDIR)/repair/phase5.c \ - $(TOPDIR)/repair/phase6.c \ - $(TOPDIR)/repair/phase7.c \ - $(TOPDIR)/repair/prefetch.c \ - $(TOPDIR)/repair/progress.c \ - $(TOPDIR)/repair/rt.c \ - $(TOPDIR)/repair/sb.c \ - $(TOPDIR)/repair/scan.c \ - $(TOPDIR)/repair/threads.c \ - $(TOPDIR)/repair/versions.c \ - $(TOPDIR)/repair/xfs_repair.c \ - $(TOPDIR)/rtcp/xfs_rtcp.c +XGETTEXTFILES = $(LOCALIZED_FILES) default: $(POTHEAD) $(LINGUAS:%=%.mo)