From 7823790beb2f16d93b59dd4dbc6c8112fb3bc97d Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 4 Nov 2007 11:00:16 +0100 Subject: Improved the 'i18n' target in plugin Makefiles --- HISTORY | 4 +++- PLUGINS/src/hello/Makefile | 22 +++++++++++----------- PLUGINS/src/skincurses/Makefile | 22 +++++++++++----------- i18n-to-gettext.pl | 24 ++++++++++++------------ newplugin | 22 +++++++++++----------- 5 files changed, 48 insertions(+), 46 deletions(-) diff --git a/HISTORY b/HISTORY index aafd062a..7bc48aa9 100644 --- a/HISTORY +++ b/HISTORY @@ -5511,4 +5511,6 @@ Video Disk Recorder Revision History in using tr(FileNameChars) (suggested by Thomas Günther). - Added a missing '.' to the date returned by DayDateTime() (thanks to Lauri Nurmi). - Improved the 'i18n' target in the Makefile to avoid unnecessary work (thanks to - Stefan Huelswitt). + Stefan Huelswitt). The 'newplugin' and 'i18n-to-gettext.pl' scripts have been + changed accordingly. Plugin authors may want to adjust the 'i18n' target + of their Makefiles. diff --git a/PLUGINS/src/hello/Makefile b/PLUGINS/src/hello/Makefile index 92e8af4a..185b527e 100644 --- a/PLUGINS/src/hello/Makefile +++ b/PLUGINS/src/hello/Makefile @@ -1,7 +1,7 @@ # # Makefile for a Video Disk Recorder plugin # -# $Id: Makefile 1.20 2007/10/14 09:23:04 kls Exp $ +# $Id: Makefile 1.21 2007/11/04 10:52:15 kls Exp $ # The official name of this plugin. # This name will be used in the '-P...' option of VDR to load the plugin. @@ -72,25 +72,25 @@ $(DEPFILE): Makefile PODIR = po LOCALEDIR = $(VDRDIR)/locale I18Npo = $(wildcard $(PODIR)/*.po) -I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file)))) -I18Ndirs = $(notdir $(foreach file, $(I18Npo), $(basename $(file)))) +I18Nmsgs = $(addprefix $(LOCALEDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file)))))) I18Npot = $(PODIR)/$(PLUGIN).pot %.mo: %.po msgfmt -c -o $@ $< $(I18Npot): $(wildcard *.c) - xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='' -o $@ $(wildcard *.c) + xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='' -o $@ $^ -$(I18Npo): $(I18Npot) +%.po: $(I18Npot) msgmerge -U --no-wrap --no-location --backup=none -q $@ $< + @touch $@ -i18n: $(I18Npot) $(I18Nmo) - @mkdir -p $(LOCALEDIR) - for i in $(I18Ndirs); do\ - mkdir -p $(LOCALEDIR)/$$i/LC_MESSAGES;\ - cp $(PODIR)/$$i.mo $(LOCALEDIR)/$$i/LC_MESSAGES/vdr-$(PLUGIN).mo;\ - done +$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo + @mkdir -p $(dir $@) + cp $< $@ + +.PHONY: i18n +i18n: $(I18Nmsgs) ### Targets: diff --git a/PLUGINS/src/skincurses/Makefile b/PLUGINS/src/skincurses/Makefile index 3eea4ddf..17f8540c 100644 --- a/PLUGINS/src/skincurses/Makefile +++ b/PLUGINS/src/skincurses/Makefile @@ -1,7 +1,7 @@ # # Makefile for a Video Disk Recorder plugin # -# $Id: Makefile 1.13 2007/10/14 09:23:25 kls Exp $ +# $Id: Makefile 1.14 2007/11/04 10:52:13 kls Exp $ # The official name of this plugin. # This name will be used in the '-P...' option of VDR to load the plugin. @@ -70,25 +70,25 @@ $(DEPFILE): Makefile PODIR = po LOCALEDIR = $(VDRDIR)/locale I18Npo = $(wildcard $(PODIR)/*.po) -I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file)))) -I18Ndirs = $(notdir $(foreach file, $(I18Npo), $(basename $(file)))) +I18Nmsgs = $(addprefix $(LOCALEDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file)))))) I18Npot = $(PODIR)/$(PLUGIN).pot %.mo: %.po msgfmt -c -o $@ $< $(I18Npot): $(wildcard *.c) - xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='' -o $@ $(wildcard *.c) + xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='' -o $@ $^ -$(I18Npo): $(I18Npot) +%.po: $(I18Npot) msgmerge -U --no-wrap --no-location --backup=none -q $@ $< + @touch $@ -i18n: $(I18Npot) $(I18Nmo) - @mkdir -p $(LOCALEDIR) - for i in $(I18Ndirs); do\ - mkdir -p $(LOCALEDIR)/$$i/LC_MESSAGES;\ - cp $(PODIR)/$$i.mo $(LOCALEDIR)/$$i/LC_MESSAGES/vdr-$(PLUGIN).mo;\ - done +$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo + @mkdir -p $(dir $@) + cp $< $@ + +.PHONY: i18n +i18n: $(I18Nmsgs) ### Targets: diff --git a/i18n-to-gettext.pl b/i18n-to-gettext.pl index b17f7d63..309a4720 100755 --- a/i18n-to-gettext.pl +++ b/i18n-to-gettext.pl @@ -10,7 +10,7 @@ # See the main source file 'vdr.c' for copyright information and # how to reach the author. # -# $Id: i18n-to-gettext.pl 1.5 2007/10/14 09:29:59 kls Exp $ +# $Id: i18n-to-gettext.pl 1.6 2007/11/04 10:57:36 kls Exp $ # How to convert an actual plugin: # @@ -306,25 +306,25 @@ $MAKEI18N = q{### Internationalization (I18N): PODIR = po LOCALEDIR = $(VDRDIR)/locale I18Npo = $(wildcard $(PODIR)/*.po) -I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file)))) -I18Ndirs = $(notdir $(foreach file, $(I18Npo), $(basename $(file)))) +I18Nmsgs = $(addprefix $(LOCALEDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file)))))) I18Npot = $(PODIR)/$(PLUGIN).pot %.mo: %.po msgfmt -c -o $@ $< $(I18Npot): $(wildcard *.c) - xgettext -C -cTRANSLATORS --no-wrap -F -k -ktr -ktrNOOP --msgid-bugs-address='<} . $MSGIDBUGS . q{>' -o $@ $(wildcard *.c) + xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='<} . $MSGIDBUGS . q{>' -o $@ $^ -$(I18Npo): $(I18Npot) - msgmerge -U --no-wrap -F --backup=none -q $@ $< +%.po: $(I18Npot) + msgmerge -U --no-wrap --no-location --backup=none -q $@ $< + @touch $@ -i18n: $(I18Npot) $(I18Nmo) - @mkdir -p $(LOCALEDIR) - for i in $(I18Ndirs); do\ - mkdir -p $(LOCALEDIR)/$$i/LC_MESSAGES;\ - cp $(PODIR)/$$i.mo $(LOCALEDIR)/$$i/LC_MESSAGES/vdr-$(PLUGIN).mo;\ - done +$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo + @mkdir -p $(dir $@) + cp $< $@ + +.PHONY: i18n +i18n: $(I18Nmsgs) }; diff --git a/newplugin b/newplugin index 57d814e8..e025f74f 100755 --- a/newplugin +++ b/newplugin @@ -12,7 +12,7 @@ # See the main source file 'vdr.c' for copyright information and # how to reach the author. # -# $Id: newplugin 1.38 2007/10/14 09:13:17 kls Exp $ +# $Id: newplugin 1.39 2007/11/04 10:42:52 kls Exp $ $PLUGIN_NAME = $ARGV[0] || die "Usage: newplugin \n"; @@ -131,25 +131,25 @@ DEPFILE = .dependencies PODIR = po LOCALEDIR = \$(VDRDIR)/locale I18Npo = \$(wildcard \$(PODIR)/*.po) -I18Nmo = \$(addsuffix .mo, \$(foreach file, \$(I18Npo), \$(basename \$(file)))) -I18Ndirs = \$(notdir \$(foreach file, \$(I18Npo), \$(basename \$(file)))) +I18Nmsgs = \$(addprefix \$(LOCALEDIR)/, \$(addsuffix /LC_MESSAGES/vdr-\$(PLUGIN).mo, \$(notdir \$(foreach file, \$(I18Npo), \$(basename \$(file)))))) I18Npot = \$(PODIR)/\$(PLUGIN).pot %.mo: %.po msgfmt -c -o \$\@ \$< \$(I18Npot): \$(wildcard *.c) - xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='' -o \$\@ \$(wildcard *.c) + xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='' -o \$\@ \$^ -\$(I18Npo): \$(I18Npot) +%.po: \$(I18Npot) msgmerge -U --no-wrap --no-location --backup=none -q \$\@ \$< + \@touch \$\@ -i18n: \$(I18Npot) \$(I18Nmo) - \@mkdir -p \$(LOCALEDIR) - for i in \$(I18Ndirs); do\\ - mkdir -p \$(LOCALEDIR)/\$\$i/LC_MESSAGES;\\ - cp \$(PODIR)/\$\$i.mo \$(LOCALEDIR)/\$\$i/LC_MESSAGES/vdr-\$(PLUGIN).mo;\\ - done +\$(I18Nmsgs): \$(LOCALEDIR)/%/LC_MESSAGES/vdr-\$(PLUGIN).mo: \$(PODIR)/%.mo + \@mkdir -p \$(dir \$@) + cp \$< \$\@ + +.PHONY: i18n +i18n: \$(I18Nmsgs) ### Targets: -- cgit v1.2.3