summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Günther <tom@toms-cafe.de>2009-05-16 11:52:15 +0200
committerThomas Günther <tom@toms-cafe.de>2009-05-16 11:52:15 +0200
commit371d910a0f31585797c1c7521a50f1945fe1d8d9 (patch)
treec66c666cc0cc1774035cf4981d6ba7c12cec319f
parent28a6a2db0c02e6b87b4b8a3a189a24f7c840f9c6 (diff)
downloadvdr-plugin-text2skin-371d910a0f31585797c1c7521a50f1945fe1d8d9.tar.gz
vdr-plugin-text2skin-371d910a0f31585797c1c7521a50f1945fe1d8d9.tar.bz2
Locales for text2skin plug-in (VDR >= 1.5.7, skins + locale patch).
Patch from http://toms-cafe.de/vdr/download/text2skin-1.1-cvs-locale.diff The skins have to be patched, too. The patches for DeepBlue, Enigma and enElchi are ready for download from http://toms-cafe.de/vdr/download/. To patch other skins the Makefile from these patches could be used without any changes, missing translation entries should be added to the *.skin file (e.g. as comments <!-- trans('Volume') -->)
-rw-r--r--Makefile64
-rw-r--r--font.c5
-rw-r--r--i18n.c10
-rw-r--r--i18n.h10
-rw-r--r--loader.c4
-rw-r--r--po/de_DE.po36
-rw-r--r--po/fi_FI.po36
-rw-r--r--status.c5
-rw-r--r--text2skin.c6
9 files changed, 156 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index a06aa12..b666db9 100644
--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,8 @@ HAVE_FREETYPE=1
# 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 @@ VERSION = $(shell grep 'const char \*cText2SkinPlugin::VERSION *=' $(PLUGIN).c |
### 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
-VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
+### The version number of VDR's plugin API (taken from VDR's "config.h"):
+
+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 @@ ifdef BENCH
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='<sascha@akv-soft.de>' -o $@ $^
+
+%.po: $(I18Npot)
+ msgmerge -U --no-wrap --no-location --backup=none -q $@ $<
+ @touch $@
-all: libvdr-$(PLUGIN).so
+$(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.po
+ @mkdir -p $(dir $@)
+ msgfmt -c -o $@ $<
+
+.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
diff --git a/font.c b/font.c
index 7042da9..706ab23 100644
--- a/font.c
+++ b/font.c
@@ -31,8 +31,13 @@ const cFont *cText2SkinFont::Load(const std::string &Path, const std::string &Fi
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);
diff --git a/i18n.c b/i18n.c
index c8a0fdc..a190a49 100644
--- a/i18n.c
+++ b/i18n.c
@@ -5,6 +5,7 @@
#include "i18n.h"
#include <vdr/config.h>
+#if VDRVERSNUM < 10507
const tI18nPhrase Phrases[] = {
/*
{ "English",
@@ -156,14 +157,22 @@ const tI18nPhrase Phrases[] = {
},
{ 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 @@ bool cText2SkinI18n::Load(const std::string &Filename) {
}
return false;
}
+#endif
diff --git a/i18n.h b/i18n.h
index d988e6b..642e53b 100644
--- a/i18n.h
+++ b/i18n.h
@@ -9,22 +9,32 @@
#include "file.h"
#include <vdr/i18n.h>
+#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()); }
};
diff --git a/loader.c b/loader.c
index a34998b..fb98533 100644
--- a/loader.c
+++ b/loader.c
@@ -34,6 +34,9 @@ void cText2SkinLoader::Start(void) {
}
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 @@ void cText2SkinLoader::Load(const char *Skin) {
if (!translations->Load(transfile))
DELETENULL(translations);
}
+#endif
cText2SkinTheme *theme = new cText2SkinTheme(Skin);
std::string themefile = SkinPath() + "/" + Skin + "/" + Skin + ".colors";
diff --git a/po/de_DE.po b/po/de_DE.po
new file mode 100644
index 0000000..1f73a85
--- /dev/null
+++ b/po/de_DE.po
@@ -0,0 +1,36 @@
+# German translations for vdr-text2skin package.
+# Copyright (C) Sascha Volkenandt <sascha@akv-soft.de>
+# This file is distributed under the same license as the vdr-text2skin package.
+# Sascha Volkenandt <sascha@akv-soft.de>, 2004, 2005.
+#
+# $Id$
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: vdr-text2skin 1.0\n"
+"Report-Msgid-Bugs-To: <sascha@akv-soft.de>\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 <sascha@akv-soft.de>\n"
+"Language-Team: <vdr@linuxtv.org>\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"
diff --git a/po/fi_FI.po b/po/fi_FI.po
new file mode 100644
index 0000000..3b99a90
--- /dev/null
+++ b/po/fi_FI.po
@@ -0,0 +1,36 @@
+# Finnish translations for vdr-text2skin package.
+# Copyright (C) Sascha Volkenandt <sascha@akv-soft.de>
+# This file is distributed under the same license as the vdr-text2skin package.
+# Rolf Ahrenberg <rahrenbe@cc.hut.fi>, 2004, 2005.
+#
+# $Id$
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: vdr-text2skin 1.0\n"
+"Report-Msgid-Bugs-To: <sascha@akv-soft.de>\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 <rahrenbe@cc.hut.fi>\n"
+"Language-Team: <vdr@linuxtv.org>\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"
diff --git a/status.c b/status.c
index bebcf93..282fac6 100644
--- a/status.c
+++ b/status.c
@@ -109,8 +109,13 @@ void cText2SkinStatus::Recording(const cDevice *Device, const char *Name,
void cText2SkinStatus::OsdClear(void)
{
+#if VDRVERSNUM >= 10507
+ if (I18nCurrentLanguage() != mLastLanguage) {
+ mLastLanguage = I18nCurrentLanguage();
+#else
if (Setup.OSDLanguage != mLastLanguage) {
mLastLanguage = Setup.OSDLanguage;
+#endif
cxString::Reparse();
}
}
diff --git a/text2skin.c b/text2skin.c
index be63af4..f28ace9 100644
--- a/text2skin.c
+++ b/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 @@ cText2SkinPlugin::~cText2SkinPlugin() {
}
bool cText2SkinPlugin::Start(void) {
+#if VDRVERSNUM < 10507
RegisterI18n(Phrases);
Text2SkinStatus.SetLanguage(Setup.OSDLanguage);
+#else
+ Text2SkinStatus.SetLanguage(I18nCurrentLanguage());
+#endif
cText2SkinLoader::Start();
return true;
}