From 97db8519c8f64dc8b0163b1eff6cbe4d6fe75c11 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Sun, 28 Mar 2010 14:49:09 +0300 Subject: build: create and install .mo translation files If --enable-translation was specified to configure, build and install .mo files for the selected message language(s). The languages enabled can be chosen with the --language-msg option; by default all available ones will be installed. The .po source files for available languages are seached under the po/ subdirectory; at the moment that subdirectory is not included in the sources so no languages will be enabled unless you add the actual translations before running configure. The .mo files are created in the locale/ subdirectory when compiling. By default MPlayer will only look for them in the installed location, so the newly compiled .mo files will not be found if you run MPlayer without installing. You can set the MPLAYER_LOCALEDIR environment variable to point to the locale/ directory to test the translations without installing. --- Makefile | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 2f1ef50364..6bcb759764 100644 --- a/Makefile +++ b/Makefile @@ -694,7 +694,9 @@ ALL_PRG-$(MPLAYER) += mplayer$(EXESUF) ALL_PRG-$(MENCODER) += mencoder$(EXESUF) INSTALL_TARGETS-$(MENCODER) += install-mencoder install-mencoder-man -INSTALL_TARGETS-$(MPLAYER) += install-mplayer install-mplayer-man +INSTALL_TARGETS-$(MPLAYER) += install-mplayer \ + install-mplayer-man \ + install-mplayer-msg DIRS = . \ input \ @@ -733,6 +735,8 @@ DIRS = . \ TOOLS \ vidix \ +MOFILES := $(MSG_LANGS:%=locale/%/LC_MESSAGES/mplayer.mo) + ALLHEADERS = $(foreach dir,$(DIRS),$(wildcard $(dir)/*.h)) ADDSUFFIXES = $(foreach suf,$(1),$(addsuffix $(suf),$(2))) @@ -741,7 +745,7 @@ ADD_ALL_EXESUFS = $(1) $(call ADDSUFFIXES,$(EXESUFS_ALL),$(1)) ###### generic rules ####### -all: $(ALL_PRG-yes) +all: $(ALL_PRG-yes) locales %.o: %.c $(CC) $(CFLAGS) -c -o $@ -MD -MP -MF $*.d $< @@ -789,6 +793,12 @@ version.h: version.sh %(EXESUF): %.c +locales: $(MOFILES) + +locale/%/LC_MESSAGES/mplayer.mo: po/%.po + mkdir -p $(dir $@) + msgfmt -c -o $@ $< + ###### dependency declarations / specific CFLAGS ###### @@ -852,6 +862,7 @@ install-%: %$(EXESUF) install-dirs install-mencoder-man: $(foreach lang,$(MAN_LANGS),install-mencoder-man-$(lang)) install-mplayer-man: $(foreach lang,$(MAN_LANGS),install-mplayer-man-$(lang)) +install-mplayer-msg: $(foreach lang,$(MSG_LANGS),install-mplayer-msg-$(lang)) install-mencoder-man-en: install-mplayer-man-en cd $(MANDIR)/man1 && ln -sf mplayer.1 mencoder.1 @@ -874,6 +885,14 @@ endef $(foreach lang,$(filter-out en,$(MAN_LANG_ALL)),$(eval $(MENCODER_MAN_RULE))) $(foreach lang,$(filter-out en,$(MAN_LANG_ALL)),$(eval $(MPLAYER_MAN_RULE))) +define MPLAYER_MSG_RULE +install-mplayer-msg-$(lang): + if test ! -d $(LOCALEDIR)/$(lang)/LC_MESSAGES ; then $(INSTALL) -d $(LOCALEDIR)/$(lang)/LC_MESSAGES ; fi + $(INSTALL) -m 644 locale/$(lang)/LC_MESSAGES/mplayer.mo $(LOCALEDIR)/$(lang)/LC_MESSAGES/ +endef + +$(foreach lang,$(MSG_LANG_ALL),$(eval $(MPLAYER_MSG_RULE))) + uninstall: rm -f $(BINDIR)/mplayer$(EXESUF) $(BINDIR)/gmplayer$(EXESUF) rm -f $(BINDIR)/mencoder$(EXESUF) @@ -882,6 +901,7 @@ uninstall: rm -f $(prefix)/share/applications/mplayer.desktop rm -f $(MANDIR)/man1/mplayer.1 $(MANDIR)/man1/mencoder.1 rm -f $(foreach lang,$(MAN_LANGS),$(foreach man,mplayer.1 mencoder.1,$(MANDIR)/$(lang)/man1/$(man))) + rm -f $(foreach lang,$(MSG_LANGS),$(LOCALEDIR)/$(lang)/LC_MESSAGES/mplayer.1) clean: -rm -f $(call ADD_ALL_DIRS,/*.o /*.a /*.ho /*~) -- cgit v1.2.3