diff options
-rw-r--r-- | Makefile | 55 | ||||
-rw-r--r-- | display.c | 8 | ||||
-rw-r--r-- | layout.c | 4 | ||||
-rw-r--r-- | menu.c | 10 | ||||
-rw-r--r-- | plugin.c | 4 |
5 files changed, 60 insertions, 21 deletions
@@ -9,6 +9,9 @@ # PLUGIN = graphlcd +# define this if you built graphlcd-base with freetype: +HAVE_FREETYPE2 = 1 + ### The version number of this plugin (taken from the main source file): VERSION = $(shell grep 'static const char \*VERSION *=' plugin.c | awk '{ print $$6 }' | sed -e 's/[";]//g') @@ -20,12 +23,11 @@ CXXFLAGS ?= -g -Wall -Woverloaded-virtual ### The directory environment: -DVBDIR = ../../../../DVB VDRDIR = ../../.. LIBDIR = ../../lib TMPDIR = /tmp -export INSTALLPREFIX = /usr/local +export INSTALLPREFIX = /usr export INSTALLDOCDIR = $(INSTALLPREFIX)/share/doc ### Allow user defined options to overwrite defaults: @@ -49,16 +51,27 @@ PACKAGE = vdr-$(ARCHIVE) ### Includes and Defines (add further entries here): -INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include -I$(INSTALLPREFIX)/include +INCLUDES += -I$(VDRDIR)/include -I$(INSTALLPREFIX)/include -DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DEFINES += -D_GNU_SOURCE +DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' +ifdef HAVE_FREETYPE2 + INCLUDES += -I$(INSTALLPREFIX)/include/freetype2 + DEFINES += -DHAVE_FREETYPE2 +endif ### The object files (add further files here): -OBJS = display.o i18n.o layout.o logo.o logolist.o menu.o plugin.o setup.o state.o strfct.o widgets.o +OBJS = display.o layout.o logo.o logolist.o menu.o plugin.o setup.o state.o strfct.o widgets.o + +### The main target: +TARGETS = libvdr-$(PLUGIN).so +ifneq ($(shell grep -l 'Phrases' $(VDRDIR)/i18n.c),$(VDRDIR)/i18n.c) +TARGETS += i18n +endif + +all: $(TARGETS) ### Implicit rules: @@ -76,12 +89,35 @@ $(DEPFILE): Makefile -include $(DEPFILE) -### Targets: +### Internationalization (I18N): -all: libvdr-$(PLUGIN).so -.PHONY: all +PODIR = po +LOCALEDIR = $(VDRDIR)/locale +I18Npo = $(wildcard $(PODIR)/*.po) +I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file)))) +I18Ndirs = $(notdir $(foreach file, $(I18Npo), $(basename $(file)))) +I18Npot = $(PODIR)/$(PLUGIN).pot +%.mo: %.po + msgfmt -c -o $@ $< + +$(I18Npot): $(wildcard *.c) + xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='<nobody@domain.com>' -o $@ $^ + +$(I18Npo): $(I18Npot) + msgmerge -U --no-wrap --no-location --backup=none -q $@ $< + @touch $@ + +i18n: $(I18Nmo) + @mkdir -p $(LOCALEDIR) + for i in $(I18Ndirs); do\ + mkdir -p $(LOCALEDIR)/$$i/LC_MESSAGES;\ + cp $(PODIR)/$$i.mo $(LOCALEDIR)/$$i/LC_MESSAGES/vdr-$(PLUGIN).mo;\ + done + +### Targets: + libvdr-$(PLUGIN).so: $(OBJS) $(CXX) $(CXXFLAGS) -L$(INSTALLPREFIX)/lib -shared $(OBJS) -lglcddrivers -lglcdgraphics -lstdc++ -o $@ @cp $@ $(LIBDIR)/$@.$(APIVERSION) @@ -95,6 +131,7 @@ dist: clean @echo Distribution package created as $(PACKAGE).tgz clean: + @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot @-rm -f *.o $(DEPFILE) *.so *.tgz core* *~ install: all @@ -22,7 +22,6 @@ #include "display.h" #include "global.h" -#include "i18n.h" #include "setup.h" #include "state.h" #include "strfct.h" @@ -723,7 +722,7 @@ void cGraphLCDDisplay::Update() void cGraphLCDDisplay::DisplayTime() { static char buffer[32]; - static char month[5]; + static char month[16]; int FrameWidth, TextLen, yPos; struct tm tm_r; @@ -758,8 +757,9 @@ void cGraphLCDDisplay::DisplayTime() time(&CurrTime); tm * tm = localtime_r(&CurrTime, &tm_r); - strncpy(month, (char *)(tr("JanFebMarAprMayJunJulAugSepOctNovDec") + 3 * tm->tm_mon), 3); - month[3] = 0; + const char *amonth = tr("JanFebMarAprMayJunJulAugSepOctNovDec"); + amonth += Utf8SymChars(amonth, tm->tm_mon * 3); + strn0cpy(month, amonth, min(Utf8SymChars(amonth, 3) + 1, int(sizeof(month)))); snprintf(buffer, sizeof(buffer), "%s %2d.%s %d:%02d", (const char *) WeekDayName(tm->tm_wday), tm->tm_mday, month, tm->tm_hour, tm->tm_min); TextLen = normalFont->Width(buffer); @@ -65,7 +65,11 @@ bool cFontElement::Load(const std::string & url) file += "/fonts/"; file += url.substr(4, pos - 4); } +#if APIVERSNUM >= 10503 + return font.LoadFT2(file, cCharSetConv::SystemCharacterTable(), size); +#else return font.LoadFT2(file, I18nCharSets()[Setup.OSDLanguage], size); +#endif } else { @@ -31,15 +31,15 @@ cGraphLCDMenuSetup::cGraphLCDMenuSetup() { static const char * showDateTimeValues[3]; - showDateTimeValues[0] = tr("no"); - showDateTimeValues[1] = tr("yes"); + showDateTimeValues[0] = trVDR("no"); + showDateTimeValues[1] = trVDR("yes"); showDateTimeValues[2] = tr("not in menu"); static const char * showSymbolsValues[3]; - showSymbolsValues[0] = tr("no"); - showSymbolsValues[1] = tr("yes"); + showSymbolsValues[0] = trVDR("no"); + showSymbolsValues[1] = trVDR("yes"); showSymbolsValues[2] = tr("compressed"); static const char * showLogoValues[4]; - showLogoValues[0] = tr("no"); + showLogoValues[0] = trVDR("no"); showLogoValues[1] = tr("auto"); showLogoValues[2] = tr("medium"); showLogoValues[3] = tr("large"); @@ -17,7 +17,6 @@ #include "display.h" #include "global.h" -#include "i18n.h" #include "menu.h" #include <vdr/plugin.h> @@ -61,6 +60,7 @@ cPluginGraphLCD::cPluginGraphLCD() mDisplayName("") { mLcd = NULL; + mDisplay = NULL; } cPluginGraphLCD::~cPluginGraphLCD() @@ -113,8 +113,6 @@ bool cPluginGraphLCD::Initialize() unsigned int displayNumber = 0; const char * cfgDir; - RegisterI18n(Phrases); - if (mConfigName.length() == 0) { mConfigName = kDefaultConfigFile; |