diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index e542154378..891e4bf9fc 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -11114,6 +11114,10 @@ A value of "noconv" means no conversion. Directory where MPlayer looks for user settings. . .TP +.B MPLAYER_LOCALEDIR +Directory where MPlayer looks for gettext translation files (if enabled). +. +.TP .B MPLAYER_VERBOSE (also see \-v and \-msglevel) Set the initial verbosity level across all message modules (default: 0). The resulting verbosity corresponds to that of \-msglevel 5 plus the 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 /*~) diff --git a/configure b/configure index 8a8f161d0b..43aadf4826 100755 --- a/configure +++ b/configure @@ -197,6 +197,8 @@ case $(echo -n) in *) _echo_n='-n ' _echo_c= ;; # BSD echo esac +msg_lang_all='' +ls po/*.po >/dev/null 2>&1 && msg_lang_all=$(echo po/*.po | sed -e 's:po/\([^[:space:]]*\)\.po:\1:g') man_lang_all=$(echo DOCS/man/??/mplayer.1 DOCS/man/??_??/mplayer.1 | sed -e "s:DOCS/man/\(..\)/mplayer.1:\1:g" -e "s:DOCS/man/\(.._..\)/mplayer.1:\1:g") doc_lang_all=$(echo DOCS/xml/??/ DOCS/xml/??_??/ | sed -e "s:DOCS/xml/\(..\)/:\1:g" -e "s:DOCS/xml/\(.._..\)/:\1:g") @@ -402,14 +404,18 @@ Language options: --charset=charset convert the console messages to this character set --language-doc=lang language to use for the documentation [en] --language-man=lang language to use for the man pages [en] + --language-msg=lang extra languages for program messages [all] --language=lang default language to use [en] Specific options override --language. You can pass a list of languages separated by whitespace or commas instead of a single language. Nonexisting translations -will be dropped from each list. All documentation and man page translations -available in the list will be installed, for the messages the first available -translation will be used. The value "all" will activate all translations. The -LINGUAS environment variable is honored. In all cases the fallback is English. -Available values are: all $man_lang_all +will be dropped from each list. All translations available in the list will be +installed. The value "all" will activate all translations. The LINGUAS +environment variable is honored. In all cases the fallback is English. +The program always supports English-language output; additional message +languages are only installed if --enable-translation is also specified. +Available values for --language-doc are: all $doc_lang_all +Available values for --language-man are: all $man_lang_all +Available values for --language-msg are: all $msg_lang_all Miscellaneous options: --enable-runtime-cpudetection enable runtime CPU detection [disable] @@ -819,6 +825,9 @@ for ac_option do --language-man=*) language_man=$(echo $ac_option | cut -d '=' -f 2) ;; + --language-msg=*) + language_msg=$(echo $ac_option | cut -d '=' -f 2) + ;; --language=*) language=$(echo $ac_option | cut -d '=' -f 2) ;; @@ -2843,11 +2852,18 @@ echocheck "language" test -z "$language" && language=$LINGUAS test -z "$language_doc" && language_doc=$language test -z "$language_man" && language_man=$language +test -z "$language_msg" && language_msg="all" language_doc=$(echo $language_doc | tr , " ") language_man=$(echo $language_man | tr , " ") +language_msg=$(echo $language_msg | tr , " ") test "$language_doc" = "all" && language_doc=$doc_lang_all test "$language_man" = "all" && language_man=$man_lang_all +test "$language_msg" = "all" && language_msg=$msg_lang_all + +if test "$_translation" != yes ; then + language_msg="" +fi # Prune non-existing translations from language lists. # Set message translation to the first available language. @@ -2864,7 +2880,12 @@ done language_man=$tmp_language_man test -z "$language_man" && language_man=en -echores "man pages: $language_man - documentation: $language_doc" +for lang in $language_msg ; do + test -f po/$lang.po && tmp_language_msg="$tmp_language_msg $lang" +done +language_msg=$tmp_language_msg + +echores "messages (en+): $language_msg - man pages: $language_man - documentation: $language_doc" echocheck "enable sighandler" @@ -7819,6 +7840,8 @@ DOC_LANGS = $language_doc DOC_LANG_ALL = $doc_lang_all MAN_LANGS = $language_man MAN_LANG_ALL = $man_lang_all +MSG_LANGS = $language_msg +MSG_LANG_ALL = $msg_lang_all prefix = \$(DESTDIR)$_prefix BINDIR = \$(DESTDIR)$_bindir @@ -8553,6 +8576,7 @@ Config files successfully generated by ./configure $_configuration ! Optimizing for: $_optimizing Languages: + Messages (in addition to English): $language_msg Manual pages: $language_man Documentation: $language_doc