mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 13:37:03 +02:00
Added localization support for non-gettext VDRs.
This commit is contained in:
parent
7bda3e47ce
commit
ea18decf44
5
HISTORY
5
HISTORY
@ -12,10 +12,9 @@ VDR Plugin 'iptv' Revision History
|
|||||||
- Fixed shutdown logic.
|
- Fixed shutdown logic.
|
||||||
- Improved error checking in protocols.
|
- Improved error checking in protocols.
|
||||||
|
|
||||||
2007-xx-xx: Version 0.0.3
|
2007-10-28: Version 0.0.3
|
||||||
|
|
||||||
- Fixed shutdown crash.
|
- Fixed shutdown crash.
|
||||||
- Added some minor tweaks.
|
- Added some minor tweaks.
|
||||||
- RTP payload now restricted to TS only.
|
- RTP payload now restricted to TS only.
|
||||||
- Added preliminary support for vdr-1.4.7
|
- Added preliminary support for vdr-1.4.7.
|
||||||
without localization.
|
|
||||||
|
40
Makefile
40
Makefile
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Makefile for a Video Disk Recorder plugin
|
# Makefile for a Video Disk Recorder plugin
|
||||||
#
|
#
|
||||||
# $Id: Makefile,v 1.20 2007/10/21 13:31:21 ajhseppa Exp $
|
# $Id: Makefile,v 1.21 2007/10/28 16:22:44 rahrenbe Exp $
|
||||||
|
|
||||||
# Debugging on/off
|
# Debugging on/off
|
||||||
#IPTV_DEBUG = 1
|
#IPTV_DEBUG = 1
|
||||||
@ -40,6 +40,9 @@ TMPDIR = /tmp
|
|||||||
|
|
||||||
APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
|
APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
|
||||||
|
|
||||||
|
### Test whether VDR has locale support
|
||||||
|
VDRLOCALE = $(shell grep '^LOCALEDIR' $(VDRDIR)/Makefile)
|
||||||
|
|
||||||
### The name of the distribution archive:
|
### The name of the distribution archive:
|
||||||
|
|
||||||
ARCHIVE = $(PLUGIN)-$(VERSION)
|
ARCHIVE = $(PLUGIN)-$(VERSION)
|
||||||
@ -59,7 +62,7 @@ endif
|
|||||||
|
|
||||||
OBJS = $(PLUGIN).o config.o setup.o device.o streamer.o protocoludp.o \
|
OBJS = $(PLUGIN).o config.o setup.o device.o streamer.o protocoludp.o \
|
||||||
protocolhttp.o protocolfile.o protocolext.o sectionfilter.o \
|
protocolhttp.o protocolfile.o protocolext.o sectionfilter.o \
|
||||||
sidscanner.o statistics.o common.o socket.o
|
sidscanner.o statistics.o common.o socket.o i18n.o
|
||||||
|
|
||||||
### The main target:
|
### The main target:
|
||||||
|
|
||||||
@ -75,7 +78,7 @@ all: libvdr-$(PLUGIN).so i18n
|
|||||||
MAKEDEP = $(CXX) -MM -MG
|
MAKEDEP = $(CXX) -MM -MG
|
||||||
DEPFILE = .dependencies
|
DEPFILE = .dependencies
|
||||||
$(DEPFILE): Makefile
|
$(DEPFILE): Makefile
|
||||||
@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
|
@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(subst i18n.c,,$(OBJS:%.o=%.c)) > $@
|
||||||
|
|
||||||
-include $(DEPFILE)
|
-include $(DEPFILE)
|
||||||
|
|
||||||
@ -87,12 +90,21 @@ I18Npo = $(wildcard $(PODIR)/*.po)
|
|||||||
I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file))))
|
I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file))))
|
||||||
I18Ndirs = $(notdir $(foreach file, $(I18Npo), $(basename $(file))))
|
I18Ndirs = $(notdir $(foreach file, $(I18Npo), $(basename $(file))))
|
||||||
I18Npot = $(PODIR)/$(PLUGIN).pot
|
I18Npot = $(PODIR)/$(PLUGIN).pot
|
||||||
|
ifeq ($(strip $(APIVERSION)),1.5.7)
|
||||||
|
I18Nvdrmo = $(PLUGIN).mo
|
||||||
|
else
|
||||||
|
I18Nvdrmo = vdr-$(PLUGIN).mo
|
||||||
|
endif
|
||||||
|
|
||||||
|
### Do gettext based i18n stuff
|
||||||
|
|
||||||
|
ifneq ($(strip $(VDRLOCALE)),)
|
||||||
|
|
||||||
%.mo: %.po
|
%.mo: %.po
|
||||||
msgfmt -c -o $@ $<
|
msgfmt -c -o $@ $<
|
||||||
|
|
||||||
$(I18Npot): $(wildcard *.c)
|
$(I18Npot): $(wildcard *.c)
|
||||||
xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='Rolf Ahrenberg' -o $@ $(wildcard *.c)
|
xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='Rolf Ahrenberg' -o $@ $(subst i18n.c,,$(wildcard *.c))
|
||||||
|
|
||||||
$(I18Npo): $(I18Npot)
|
$(I18Npo): $(I18Npot)
|
||||||
msgmerge -U --no-wrap --no-location --backup=none -q $@ $<
|
msgmerge -U --no-wrap --no-location --backup=none -q $@ $<
|
||||||
@ -101,9 +113,25 @@ i18n: $(I18Npot) $(I18Nmo)
|
|||||||
@mkdir -p $(LOCALEDIR)
|
@mkdir -p $(LOCALEDIR)
|
||||||
for i in $(I18Ndirs); do\
|
for i in $(I18Ndirs); do\
|
||||||
mkdir -p $(LOCALEDIR)/$$i/LC_MESSAGES;\
|
mkdir -p $(LOCALEDIR)/$$i/LC_MESSAGES;\
|
||||||
cp $(PODIR)/$$i.mo $(LOCALEDIR)/$$i/LC_MESSAGES/vdr-$(PLUGIN).mo;\
|
cp $(PODIR)/$$i.mo $(LOCALEDIR)/$$i/LC_MESSAGES/$(I18Nvdrmo);\
|
||||||
done
|
done
|
||||||
|
|
||||||
|
i18n.c: i18n-template.c
|
||||||
|
@cp i18n-template.c i18n.c
|
||||||
|
|
||||||
|
### Do i18n.c based i18n stuff
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
i18n:
|
||||||
|
@### nothing to do
|
||||||
|
|
||||||
|
#i18n compatibility generator:
|
||||||
|
i18n.c: i18n-template.c po2i18n.pl $(I18Npo)
|
||||||
|
./po2i18n.pl < i18n-template.c > i18n.c
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
### Targets:
|
### Targets:
|
||||||
|
|
||||||
libvdr-$(PLUGIN).so: $(OBJS)
|
libvdr-$(PLUGIN).so: $(OBJS)
|
||||||
@ -122,4 +150,4 @@ dist: clean
|
|||||||
@echo Distribution package created as $(PACKAGE).tgz
|
@echo Distribution package created as $(PACKAGE).tgz
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot
|
@-rm -f $(OBJS) $(DEPFILE) i18n.c *.so *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot
|
||||||
|
2
README
2
README
@ -161,3 +161,5 @@ Notes:
|
|||||||
Acknowledgements:
|
Acknowledgements:
|
||||||
|
|
||||||
- The IPTV section filtering code is derived from Linux kernel.
|
- The IPTV section filtering code is derived from Linux kernel.
|
||||||
|
|
||||||
|
- Udo Richter's po2i18n package is used to support VDR's old i18n system.
|
||||||
|
3
common.h
3
common.h
@ -3,13 +3,14 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: common.h,v 1.17 2007/10/26 23:18:49 rahrenbe Exp $
|
* $Id: common.h,v 1.18 2007/10/28 16:22:44 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __IPTV_COMMON_H
|
#ifndef __IPTV_COMMON_H
|
||||||
#define __IPTV_COMMON_H
|
#define __IPTV_COMMON_H
|
||||||
|
|
||||||
#include <vdr/tools.h>
|
#include <vdr/tools.h>
|
||||||
|
#include <vdr/config.h>
|
||||||
#include <vdr/i18n.h>
|
#include <vdr/i18n.h>
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
3
config.h
3
config.h
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: config.h,v 1.16 2007/10/20 17:26:46 rahrenbe Exp $
|
* $Id: config.h,v 1.17 2007/10/28 16:22:44 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __IPTV_CONFIG_H
|
#ifndef __IPTV_CONFIG_H
|
||||||
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#include <vdr/menuitems.h>
|
#include <vdr/menuitems.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
class cIptvConfig
|
class cIptvConfig
|
||||||
{
|
{
|
||||||
|
18
i18n-template.c
Normal file
18
i18n-template.c
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* i18n.c: IPTV plugin for the Video Disk Recorder
|
||||||
|
*
|
||||||
|
* See the README file for copyright information and how to reach the author.
|
||||||
|
*
|
||||||
|
* $Id: i18n-template.c,v 1.1 2007/10/28 16:22:44 rahrenbe Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include "i18n.h"
|
||||||
|
|
||||||
|
#if defined(APIVERSNUM) && APIVERSNUM < 10507
|
||||||
|
const tI18nPhrase IptvPhrases[] = {
|
||||||
|
// START I18N
|
||||||
|
// END I18N
|
||||||
|
{ NULL }
|
||||||
|
};
|
||||||
|
#endif
|
18
i18n.h
Normal file
18
i18n.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* i18n.h: IPTV plugin for the Video Disk Recorder
|
||||||
|
*
|
||||||
|
* See the README file for copyright information and how to reach the author.
|
||||||
|
*
|
||||||
|
* $Id: i18n.h,v 1.1 2007/10/28 16:22:44 rahrenbe Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __IPTV_I18N_H
|
||||||
|
#define __IPTV_I18N_H
|
||||||
|
|
||||||
|
#include <vdr/i18n.h>
|
||||||
|
|
||||||
|
#if defined(APIVERSNUM) && APIVERSNUM < 10507
|
||||||
|
extern const tI18nPhrase IptvPhrases[];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // __IPTV_I18N_H
|
10
iptv.c
10
iptv.c
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: iptv.c,v 1.26 2007/10/26 23:13:24 rahrenbe Exp $
|
* $Id: iptv.c,v 1.27 2007/10/28 16:22:44 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
@ -12,6 +12,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
|
#include "i18n.h"
|
||||||
|
|
||||||
#ifndef PLUGINPARAMPATCHVERSNUM
|
#ifndef PLUGINPARAMPATCHVERSNUM
|
||||||
#error "You must apply the pluginparam patch for VDR!"
|
#error "You must apply the pluginparam patch for VDR!"
|
||||||
@ -21,8 +22,8 @@
|
|||||||
#error "You must apply the closefilter patch for VDR!"
|
#error "You must apply the closefilter patch for VDR!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char *VERSION = "0.0.3";
|
static const char VERSION[] = "0.0.3";
|
||||||
static const char *DESCRIPTION = trNOOP("Experience the IPTV");
|
static const char DESCRIPTION[] = trNOOP("Experience the IPTV");
|
||||||
|
|
||||||
class cPluginIptv : public cPlugin {
|
class cPluginIptv : public cPlugin {
|
||||||
private:
|
private:
|
||||||
@ -99,6 +100,9 @@ bool cPluginIptv::Initialize(void)
|
|||||||
{
|
{
|
||||||
debug("cPluginIptv::Initialize()\n");
|
debug("cPluginIptv::Initialize()\n");
|
||||||
// Initialize any background activities the plugin shall perform.
|
// Initialize any background activities the plugin shall perform.
|
||||||
|
#if defined(APIVERSNUM) && APIVERSNUM < 10507
|
||||||
|
RegisterI18n(IptvPhrases);
|
||||||
|
#endif
|
||||||
IptvConfig.SetConfigDirectory(cPlugin::ConfigDirectory(PLUGIN_NAME_I18N));
|
IptvConfig.SetConfigDirectory(cPlugin::ConfigDirectory(PLUGIN_NAME_I18N));
|
||||||
return cIptvDevice::Initialize(deviceCount);
|
return cIptvDevice::Initialize(deviceCount);
|
||||||
}
|
}
|
||||||
|
156
po2i18n.pl
Executable file
156
po2i18n.pl
Executable file
@ -0,0 +1,156 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
#
|
||||||
|
# po2i18n - Convert plugin po files in into i18n.c-format
|
||||||
|
#
|
||||||
|
# See the README file for copyright information and how to reach the author.
|
||||||
|
#
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my @LANGS = (
|
||||||
|
"en_US",
|
||||||
|
"de_DE",
|
||||||
|
"sl_SI",
|
||||||
|
"it_IT",
|
||||||
|
"nl_NL",
|
||||||
|
"pt_PT",
|
||||||
|
"fr_FR",
|
||||||
|
"nn_NO",
|
||||||
|
"fi_FI",
|
||||||
|
"pl_PL",
|
||||||
|
"es_ES",
|
||||||
|
"el_GR",
|
||||||
|
"sv_SE",
|
||||||
|
"ro_RO",
|
||||||
|
"hu_HU",
|
||||||
|
"ca_ES",
|
||||||
|
"ru_RU",
|
||||||
|
"hr_HR",
|
||||||
|
"et_EE",
|
||||||
|
"da_DK",
|
||||||
|
"cs_CZ",
|
||||||
|
"tr_TR"
|
||||||
|
);
|
||||||
|
|
||||||
|
my %VERS = (
|
||||||
|
"en_US" => 10200,
|
||||||
|
"de_DE" => 10200,
|
||||||
|
"sl_SI" => 10200,
|
||||||
|
"it_IT" => 10200,
|
||||||
|
"nl_NL" => 10200,
|
||||||
|
"pt_PT" => 10200,
|
||||||
|
"fr_FR" => 10200,
|
||||||
|
"nn_NO" => 10200,
|
||||||
|
"fi_FI" => 10200,
|
||||||
|
"pl_PL" => 10200,
|
||||||
|
"es_ES" => 10200,
|
||||||
|
"el_GR" => 10200,
|
||||||
|
"sv_SE" => 10200,
|
||||||
|
"ro_RO" => 10200,
|
||||||
|
"hu_HU" => 10200,
|
||||||
|
"ca_ES" => 10200,
|
||||||
|
"ru_RU" => 10302,
|
||||||
|
"hr_HR" => 10307,
|
||||||
|
"et_EE" => 10313,
|
||||||
|
"da_DK" => 10316,
|
||||||
|
"cs_CZ" => 10342,
|
||||||
|
"tr_TR" => 10502
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
my %strings;
|
||||||
|
|
||||||
|
foreach my $lang (@LANGS) { $strings{$lang} = { }; }
|
||||||
|
|
||||||
|
|
||||||
|
sub LoadLanguage(*) {
|
||||||
|
my ($lang) = @_;
|
||||||
|
|
||||||
|
if (!open FILE, "<", "po/$lang.po") {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $msgid = "";
|
||||||
|
my $msgstr = "";
|
||||||
|
my $last = 0; # 0=init, 1=msgid was last, 2=msgstr was last
|
||||||
|
|
||||||
|
while (<FILE>) {
|
||||||
|
chomp;
|
||||||
|
my $line = $_;
|
||||||
|
|
||||||
|
if ($line =~ /^msgid "(.*)"$/) {
|
||||||
|
if ($last eq 2) {
|
||||||
|
$strings{$lang}->{$msgid} = $msgstr;
|
||||||
|
$strings{"en_US"}->{$msgid} = $msgid;
|
||||||
|
}
|
||||||
|
$msgid = $1;
|
||||||
|
$last = 1;
|
||||||
|
} elsif ($line =~ /^msgstr "(.*)"/) {
|
||||||
|
$msgstr = $1;
|
||||||
|
$last = 2;
|
||||||
|
} elsif ($line =~ /^"(.*)"/) {
|
||||||
|
if ($last eq 1) {
|
||||||
|
$msgid = $msgid . $1;
|
||||||
|
} elsif ($last eq 2) {
|
||||||
|
$msgstr = $msgstr . $1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($last eq 2) {
|
||||||
|
$strings{$lang}->{$msgid} = $msgstr;
|
||||||
|
$strings{"en_US"}->{$msgid} = $msgid;
|
||||||
|
}
|
||||||
|
|
||||||
|
close FILE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
foreach my $lang (@LANGS) {
|
||||||
|
LoadLanguage($lang);
|
||||||
|
}
|
||||||
|
|
||||||
|
my @msgids = sort keys %{$strings{"en_US"}};
|
||||||
|
|
||||||
|
|
||||||
|
my $silent = 0;
|
||||||
|
|
||||||
|
while (<>) {
|
||||||
|
my $line = $_;
|
||||||
|
|
||||||
|
if ($line =~ /^\/\/ START I18N/) {
|
||||||
|
print "// START I18N - automatically generated by po2i18n.pl\n";
|
||||||
|
for my $msgid (@msgids) {
|
||||||
|
next if $msgid eq "";
|
||||||
|
|
||||||
|
my $head = " { ";
|
||||||
|
my $endif = "";
|
||||||
|
my $versnum = 10200;
|
||||||
|
|
||||||
|
for my $lang (@LANGS) {
|
||||||
|
if ($VERS{$lang} ne $versnum) {
|
||||||
|
$versnum = $VERS{$lang};
|
||||||
|
print $endif;
|
||||||
|
print "#if VDRVERSNUM >= $versnum\n";
|
||||||
|
$endif = "#endif\n";
|
||||||
|
}
|
||||||
|
my $msgstr = $strings{$lang}->{$msgid};
|
||||||
|
$msgstr = "" if !defined $msgstr;
|
||||||
|
|
||||||
|
print "$head\"$msgstr\",\n";
|
||||||
|
$head = " ";
|
||||||
|
}
|
||||||
|
print $endif;
|
||||||
|
print " },\n";
|
||||||
|
}
|
||||||
|
$silent = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$silent) { print $line; }
|
||||||
|
|
||||||
|
if ($line =~ /^\/\/ END I18N/) {
|
||||||
|
print "// END I18N - automatically generated by po2i18n.pl\n";
|
||||||
|
$silent = 0;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user