makefile: Cleanup translation build rules

This commit is contained in:
Thomas Perl 2012-02-25 15:38:15 +01:00
parent c3388dcfd6
commit fed3c0b78a
3 changed files with 44 additions and 73 deletions

11
bin/gpo
View File

@ -317,7 +317,10 @@ class gPodderCli(object):
old_title = podcast.title
podcast.rename(title)
self.client.commit()
self._info(_('Renamed %s to %s.') % (old_title, title))
self._info(_('Renamed %(old_title)s to %(new_title)s.') % {
'old_title': old_title,
'new_title': new_title,
})
return True
@ -577,7 +580,11 @@ class gPodderCli(object):
self._error(_('Invalid URL: %s') % new_url)
else:
new_url = result
self._error(_('Changed URL from %s to %s.') % (old_url, new_url))
self._error(_('Changed URL from %(old_url)s to %(new_url)s.') %
{
'old_url': old_url,
'new_url': new_url,
})
return True
def help(self):

View File

@ -20,22 +20,8 @@
##########################################################################
BINFILE = bin/gpodder
MESSAGESPOT = po/messages.pot
POFILES = $(wildcard po/*.po)
MANPAGE = share/man/man1/gpodder.1
UIFILES=$(wildcard share/gpodder/ui/gtk/*.ui)
UIFILES_H=$(subst .ui,.ui.h,$(UIFILES))
QMLFILES=$(wildcard share/gpodder/ui/qml/*.qml)
TRANSLATABLE_SOURCE=$(wildcard src/gpodder/*.py \
src/gpodder/gtkui/*.py \
src/gpodder/gtkui/interface/*.py \
src/gpodder/gtkui/desktop/*.py \
src/gpodder/qmlui/*.py \
src/gpodder/webui/*.py \
src/gpodder/plugins/*.py \
share/gpodder/extensions/*.py)
GPODDER_SERVICE_FILE=share/dbus-1/services/org.gpodder.service
GPODDER_SERVICE_FILE_IN=$(addsuffix .in,$(GPODDER_SERVICE_FILE))
@ -43,6 +29,28 @@ GPODDER_DESKTOP_FILE=share/applications/gpodder.desktop
GPODDER_DESKTOP_FILE_IN=$(addsuffix .in,$(GPODDER_DESKTOP_FILE))
GPODDER_DESKTOP_FILE_H=$(addsuffix .h,$(GPODDER_DESKTOP_FILE_IN))
MESSAGES = po/messages.pot
POFILES = $(wildcard po/*.po)
LOCALEDIR = share/locale
MOFILES = $(patsubst po/%.po,$(LOCALEDIR)/%/LC_MESSAGES/gpodder.mo, $(POFILES))
UIFILES=$(wildcard share/gpodder/ui/gtk/*.ui)
UIFILES_H=$(subst .ui,.ui.h,$(UIFILES))
QMLFILES=$(wildcard share/gpodder/ui/qml/*.qml)
GETTEXT_SOURCE=$(wildcard src/gpodder/*.py \
src/gpodder/gtkui/*.py \
src/gpodder/gtkui/interface/*.py \
src/gpodder/gtkui/desktop/*.py \
src/gpodder/qmlui/*.py \
src/gpodder/webui/*.py \
src/gpodder/plugins/*.py \
share/gpodder/extensions/*.py)
GETTEXT_SOURCE += $(UIFILES_H)
GETTEXT_SOURCE += $(QMLFILES)
GETTEXT_SOURCE += $(wildcard bin/*)
GETTEXT_SOURCE += $(GPODDER_DESKTOP_FILE_H)
DESTDIR ?= /
PREFIX ?= /usr
@ -90,14 +98,20 @@ $(MANPAGE): src/gpodder/__init__.py $(BINFILE)
##########################################################################
messages: $(MESSAGESPOT)
$(MAKE) -C po
messages: $(MOFILES)
%.ui.h: $(UIFILES)
intltool-extract --quiet --type=gettext/glade $(subst .ui.h,.ui,$@)
%.po: $(MESSAGES)
msgmerge --silent $@ $< --output-file=$@
$(MESSAGESPOT): $(TRANSLATABLE_SOURCE) $(UIFILES_H) $(QMLFILES) $(BINFILE) $(GPODDER_DESKTOP_FILE_H)
xgettext -LPython -k_:1 -kN_:1 -kN_:1,2 -kn_:1,2 -o $(MESSAGESPOT) $^
$(LOCALEDIR)/%/LC_MESSAGES/gpodder.mo: po/%.po
@mkdir -p $(@D)
msgfmt $< -o $@
%.ui.h: %.ui
intltool-extract --quiet --type=gettext/glade $<
$(MESSAGES): $(GETTEXT_SOURCE)
xgettext -LPython -k_:1 -kN_:1 -kN_:1,2 -kn_:1,2 -o $(MESSAGES) $^
##########################################################################
@ -120,8 +134,7 @@ clean:
rm -f $(GPODDER_SERVICE_FILE)
rm -f $(GPODDER_DESKTOP_FILE)
rm -f $(GPODDER_DESKTOP_FILE_H)
rm -rf build
$(MAKE) -C po clean
rm -rf build $(LOCALEDIR)
distclean: clean
rm -rf dist

View File

@ -1,49 +0,0 @@
#
# gPodder - A media aggregator and podcast client
# Copyright (c) 2005-2012 Thomas Perl and the gPodder Team
#
# gPodder is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# gPodder is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
PO_FILES = $(wildcard *.po)
POT_FILE = messages.pot
LOCALE_DIR = ../share/locale/
# Check for $LINGUAS presence.
ifeq ($(origin LINGUAS), undefined)
PO_INSTALL = $(PO_FILES)
else
PO_INSTALL = $(addsuffix .po,$(filter $(subst .po,,$(PO_FILES)),$(LINGUAS)))
endif
MO_FILES = $(addsuffix /LC_MESSAGES/gpodder.mo,$(addprefix $(LOCALE_DIR),$(subst .po,,$(PO_INSTALL))))
all: $(PO_INSTALL) $(MO_FILES)
%.po: $(POT_FILE)
@echo "Merging $(notdir $<) -> $@"
@msgmerge --silent $@ $< --output-file=$@
%.mo: $(PO_INSTALL)
@echo "Compiling $(subst /LC_MESSAGES/gpodder.mo,.po,$(subst $(LOCALE_DIR),,$@)) -> $(notdir $@)"
@mkdir -p $(@D)
@msgfmt $(subst /LC_MESSAGES/gpodder.mo,.po,$(subst $(LOCALE_DIR),,$@)) -o $@
clean:
rm -rf $(LOCALE_DIR) *.mo
.PHONY: all clean