#! /bin/sh /usr/share/dpatch/dpatch-run ## 95_text2skin-1.1-cvs-locale.dpatch by Thomas Günther ## http://toms-cafe.de/vdr/download/text2skin-1.1-cvs-locale.diff ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Locales for text2skin plug-in (VDR >= 1.5.7, skins + locale patch). ## DP: Bases on cvs snapshot from 2008-01-22 22:30:00Z + 2 patches: ## DP: - libfreetype6-2.2.1.diff by Jerome ## DP: http://vdrportal.de/board/thread.php?postid=489175#post489175 ## DP: - text2skin-1.1-cvs_ext-0.10-vdr-1.5.4.diff by Stone ## DP: http://vdrportal.de/board/thread.php?postid=621984#post621984 ## DP: The skins have to be patched, too: ## DP: - DeepBlue (http://vdr.pfroen.de) ## DP: http://toms-cafe.de/vdr/download/deepblue-0.1.4-locale.diff ## DP: - Enigma (http://home.pages.at/brougs78/vdr_enigma.htm) ## DP: http://toms-cafe.de/vdr/download/enigma-0.3a-locale.diff ## DP: - enElchi (http://www.saunalahti.fi/~rahrenbe/vdr/soppalusikka/files/) ## DP: http://toms-cafe.de/vdr/download/enelchi-0.7.2-locale.diff ## DP: - to patch other skins the Makefile from these patches could be used ## DP: without any changes, missing translation entries should be added to ## DP: the *.skin file (e.g. as comments ) @DPATCH@ --- text2skin-1.0+cvs20080122.2311/Makefile +++ text2skin-1.0+cvs20080122.2311/Makefile @@ -19,6 +19,8 @@ # The official name of this plugin. # This name will be used in the '-P...' option of VDR to load the plugin. # By default the main source file also carries this name. +# IMPORTANT: the presence of this macro is important for the Make.config +# file. So it must be defined, even if it is not used here! # PLUGIN = text2skin @@ -29,28 +31,28 @@ ### The C++ compiler and options: CXX ?= g++ -CXXFLAGS ?= -Wall -Woverloaded-virtual +CXXFLAGS ?= -fPIC -Wall -Woverloaded-virtual ### The directory environment: -DVBDIR = ../../../../DVB VDRDIR = ../../.. LIBDIR = ../../lib TMPDIR = /tmp -### The version number of VDR (taken from VDR's "config.h"): +### Allow user defined options to overwrite defaults: + +-include $(VDRDIR)/Make.config + +### The version number of VDR's plugin API (taken from VDR's "config.h"): -VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') +APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' \ + $(VDRDIR)/config.h) ### The name of the distribution archive: ARCHIVE = $(PLUGIN)-$(VERSION) PACKAGE = vdr-$(ARCHIVE) -### Allow user defined options to overwrite defaults: - --include $(VDRDIR)/Make.config - ### The object files (add further files here): OBJS = $(PLUGIN).o loader.o display.o render.o common.o bitmap.o \ @@ -95,43 +97,67 @@ endif endif -INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/linux/include -I$(DVBDIR)/include -I. +INCLUDES += -I$(VDRDIR)/include -I. DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' +### The main target: + +all: libvdr-$(PLUGIN).so i18n + ### Implicit rules: %.o: %.c $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $< -# Dependencies: +### Dependencies: -MAKEDEP = g++ -MM -MG +MAKEDEP = $(CXX) -MM -MG DEPFILE = .dependencies $(DEPFILE): Makefile @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@ -include $(DEPFILE) -### Targets: +### Internationalization (I18N): + +PODIR = po +LOCALEDIR = $(VDRDIR)/locale +I18Npo = $(notdir $(wildcard $(PODIR)/*.po)) +I18Npot = $(PODIR)/$(PLUGIN).pot + +$(I18Npot): $(wildcard *.c) + xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP \ + --msgid-bugs-address='' -o $@ $^ + +%.po: $(I18Npot) + msgmerge -U --no-wrap --no-location --backup=none -q $@ $< + @touch $@ + +$(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.po + @mkdir -p $(dir $@) + msgfmt -c -o $@ $< -all: libvdr-$(PLUGIN).so +.PHONY: i18n +i18n: $(I18Npo:%.po=$(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo) + +### Targets: libvdr-$(PLUGIN).so: $(OBJS) $(CXX) $(CXXFLAGS) -shared $(OBJS) $(LIBS) -o $@ - @cp $@ $(LIBDIR)/$@.$(VDRVERSION) + @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION) ifndef DEBUG - strip $(LIBDIR)/$@.$(VDRVERSION) + strip $(LIBDIR)/$@.$(APIVERSION) endif dist: clean @-rm -rf $(TMPDIR)/$(ARCHIVE) @mkdir $(TMPDIR)/$(ARCHIVE) @cp -a * $(TMPDIR)/$(ARCHIVE) - @ln -s $(ARCHIVE) $(TMPDIR)/$(PLUGIN) - @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE) $(PLUGIN) - @-rm -rf $(TMPDIR)/$(ARCHIVE) $(TMPDIR)/$(PLUGIN) + @tar czf $(PACKAGE).tgz -C $(TMPDIR) \ + --exclude debian --exclude CVS --exclude .svn $(ARCHIVE) + @-rm -rf $(TMPDIR)/$(ARCHIVE) @echo Distribution package created as $(PACKAGE).tgz clean: - @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ SKINS SKINS.de + @-rm -f $(OBJS) $(DEPFILE) *.so $(I18Npot) *.tgz core* *~ SKINS SKINS.de --- text2skin-1.0+cvs20080122.2311/font.c +++ text2skin-1.0+cvs20080122.2311/font.c @@ -31,8 +31,13 @@ const cFont *res = NULL; #ifdef HAVE_FREETYPE char *cachename; +#if VDRVERSNUM >= 10507 + asprintf(&cachename, "%s_%d_%d_%d", Filename.c_str(), Size, Width, I18nCurrentLanguage()); + if (mFontCache.Load(Path + "/" + Filename, cachename, Size, I18nCurrentLanguage(), Width)) +#else asprintf(&cachename, "%s_%d_%d_%d", Filename.c_str(), Size, Width, Setup.OSDLanguage); if (mFontCache.Load(Path + "/" + Filename, cachename, Size, Setup.OSDLanguage, Width)) +#endif res = mFontCache.GetFont(cachename); else esyslog("ERROR: Text2Skin: Couldn't load font %s:%d", Filename.c_str(), Size); --- text2skin-1.0+cvs20080122.2311/i18n.c +++ text2skin-1.0+cvs20080122.2311/i18n.c @@ -5,6 +5,7 @@ #include "i18n.h" #include +#if VDRVERSNUM < 10507 const tI18nPhrase Phrases[] = { /* { "English", @@ -156,14 +157,22 @@ }, { NULL } }; +#endif +#if VDRVERSNUM >= 10507 +cText2SkinI18n::cText2SkinI18n(const char *Skin) { + mIdentity = std::string("vdr-"PLUGIN_NAME_I18N"-") + Skin; + I18nRegister(mIdentity.substr(mIdentity.find('-') + 1).c_str()); +#else cText2SkinI18n::cText2SkinI18n(const char *Skin): cText2SkinFile(Skin) { mIdentity = (std::string)"text2skin_" + Skin; mNumPhrases = 0; mPhrases = (tI18nPhrase*)malloc(sizeof(tI18nPhrase)); memset(mPhrases[mNumPhrases], 0, sizeof(tI18nPhrase)); +#endif } +#if VDRVERSNUM < 10507 cText2SkinI18n::~cText2SkinI18n() { for (int i = 0; mPhrases[i][0]; ++i) { for (int j = 0; j < I18nNumLanguages; ++j) @@ -219,3 +228,4 @@ } return false; } +#endif --- text2skin-1.0+cvs20080122.2311/i18n.h +++ text2skin-1.0+cvs20080122.2311/i18n.h @@ -9,22 +9,32 @@ #include "file.h" #include +#if VDRVERSNUM < 10507 +#define trNOOP(s) (s) + extern const tI18nPhrase Phrases[]; class cText2SkinI18n: public cText2SkinFile { +#else +class cText2SkinI18n { +#endif private: std::string mIdentity; +#if VDRVERSNUM < 10507 tI18nPhrase *mPhrases; int mNumPhrases; protected: virtual bool Parse(const char *Text); +#endif public: cText2SkinI18n(const char *Skin); +#if VDRVERSNUM < 10507 virtual ~cText2SkinI18n(); virtual bool Load(const std::string &Filename); +#endif std::string Translate(const std::string &Text) { return I18nTranslate(Text.c_str(), mIdentity.c_str()); } }; --- text2skin-1.0+cvs20080122.2311/loader.c +++ text2skin-1.0+cvs20080122.2311/loader.c @@ -34,6 +34,9 @@ } void cText2SkinLoader::Load(const char *Skin) { +#if VDRVERSNUM >= 10507 + cText2SkinI18n *translations = new cText2SkinI18n(Skin); +#else cText2SkinI18n *translations = NULL; std::string transfile = SkinPath() + "/" + Skin + "/" + Skin + ".trans"; if (access(transfile.c_str(), F_OK) == 0) { @@ -41,6 +44,7 @@ if (!translations->Load(transfile)) DELETENULL(translations); } +#endif cText2SkinTheme *theme = new cText2SkinTheme(Skin); std::string themefile = SkinPath() + "/" + Skin + "/" + Skin + ".colors"; --- text2skin-1.0+cvs20080122.2311/status.c +++ text2skin-1.0+cvs20080122.2311/status.c @@ -109,8 +109,13 @@ void cText2SkinStatus::OsdClear(void) { +#if VDRVERSNUM >= 10507 + if (I18nCurrentLanguage() != mLastLanguage) { + mLastLanguage = I18nCurrentLanguage(); +#else if (Setup.OSDLanguage != mLastLanguage) { mLastLanguage = Setup.OSDLanguage; +#endif cxString::Reparse(); } } --- text2skin-1.0+cvs20080122.2311/text2skin.c +++ text2skin-1.0+cvs20080122.2311/text2skin.c @@ -15,7 +15,7 @@ const char *cText2SkinPlugin::VERSION = "1.1-cvs"; const char *cText2SkinPlugin::SKINVERSION = "1.0"; -const char *cText2SkinPlugin::DESCRIPTION = "Loader for text-based skins"; +const char *cText2SkinPlugin::DESCRIPTION = trNOOP("Loader for text-based skins"); cText2SkinPlugin::cText2SkinPlugin(void) { } @@ -24,8 +24,12 @@ } bool cText2SkinPlugin::Start(void) { +#if VDRVERSNUM < 10507 RegisterI18n(Phrases); Text2SkinStatus.SetLanguage(Setup.OSDLanguage); +#else + Text2SkinStatus.SetLanguage(I18nCurrentLanguage()); +#endif cText2SkinLoader::Start(); return true; } --- text2skin-1.0+cvs20080122.2311/po/de_DE.po 1970-01-01 00:00:00.000000000 +0000 +++ text2skin-1.0+cvs20080122.2311/po/de_DE.po @@ -0,0 +1,36 @@ +# German translations for vdr-text2skin package. +# Copyright (C) Sascha Volkenandt +# This file is distributed under the same license as the vdr-text2skin package. +# Sascha Volkenandt , 2004, 2005. +# +# $Id$ +# +msgid "" +msgstr "" +"Project-Id-Version: vdr-text2skin 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2008-01-26 14:59+0100\n" +"PO-Revision-Date: 2008-01-26 12:38+0100\n" +"Last-Translator: Sascha Volkenandt \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-15\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "*** Invalid Channel ***" +msgstr "" + +msgid "Skin too large or incorrectly aligned" +msgstr "Skin zu groß oder nicht korrekt ausgerichtet" + +msgid "Flush image cache" +msgstr "Bildspeicher leeren" + +msgid "Max. image cache size" +msgstr "Max. Größe des Bildspeichers" + +msgid "Flushing image cache..." +msgstr "Bildspeicher wird geleert..." + +msgid "Loader for text-based skins" +msgstr "Lader für textbasierte Skins" --- text2skin-1.0+cvs20080122.2311/po/fi_FI.po 1970-01-01 00:00:00.000000000 +0000 +++ text2skin-1.0+cvs20080122.2311/po/fi_FI.po @@ -0,0 +1,36 @@ +# Finnish translations for vdr-text2skin package. +# Copyright (C) Sascha Volkenandt +# This file is distributed under the same license as the vdr-text2skin package. +# Rolf Ahrenberg , 2004, 2005. +# +# $Id$ +# +msgid "" +msgstr "" +"Project-Id-Version: vdr-text2skin 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2008-01-26 14:59+0100\n" +"PO-Revision-Date: 2008-01-26 12:38+0100\n" +"Last-Translator: Rolf Ahrenberg \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-15\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "*** Invalid Channel ***" +msgstr "" + +msgid "Skin too large or incorrectly aligned" +msgstr "Ulkoasu on liian suuri tai väärin asemoitu" + +msgid "Flush image cache" +msgstr "Tyhjennä kuvat välimuistista" + +msgid "Max. image cache size" +msgstr "Välimuistin maksimikoko" + +msgid "Flushing image cache..." +msgstr "Tyhjennetään välimuistia..." + +msgid "Loader for text-based skins" +msgstr "Helposti muokattavat ulkoasut"