The new option --localedir can be used to set the locale directory at runtime

This commit is contained in:
Klaus Schmidinger 2008-01-19 12:25:54 +01:00
parent a51eb0895c
commit 6d8f92e240
6 changed files with 31 additions and 11 deletions

View File

@ -223,6 +223,7 @@ Stefan Huelswitt <huels@iname.com>
for suggesting to increase the APIVERSION to allow plugins that relied on the
cStatus::MsgSetVolume() bug to react properly
for improving the 'i18n' target in the Makefile to avoid unnecessary work
for a patch that was used to implement the --localedir option
Ulrich Röder <roeder@efr-net.de>
for pointing out that there are channels that have a symbol rate higher than 27500

View File

@ -5569,3 +5569,5 @@ Video Disk Recorder Revision History
- Fixed the Play function in the pictures plugin.
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Updated the Makefile of the skincurses plugin (thanks to Rolf Ahrenberg).
- The new option --localedir can be used to set the locale directory at runtime
(based on a patch from Stefan Huelswitt).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.h 1.303 2007/11/25 13:45:48 kls Exp $
* $Id: config.h 1.304 2008/01/19 12:08:29 kls Exp $
*/
#ifndef __CONFIG_H
@ -22,13 +22,13 @@
// VDR's own version number:
#define VDRVERSION "1.5.13"
#define VDRVERSNUM 10513 // Version * 10000 + Major * 100 + Minor
#define VDRVERSION "1.5.14"
#define VDRVERSNUM 10514 // Version * 10000 + Major * 100 + Minor
// The plugin API's version number:
#define APIVERSION "1.5.13"
#define APIVERSNUM 10513 // Version * 10000 + Major * 100 + Minor
#define APIVERSION "1.5.14"
#define APIVERSNUM 10514 // Version * 10000 + Major * 100 + Minor
// When loading plugins, VDR searches them by their APIVERSION, which
// may be smaller than VDRVERSION in case there have been no changes to

6
i18n.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: i18n.c 1.318 2007/11/01 10:38:27 kls Exp $
* $Id: i18n.c 1.319 2008/01/19 12:07:11 kls Exp $
*
*
*/
@ -100,8 +100,10 @@ static void SetEnvLanguage(const char *Locale)
++_nl_msg_cat_cntr;
}
void I18nInitialize(void)
void I18nInitialize(const char *LocaleDir)
{
if (LocaleDir)
I18nLocaleDir = LocaleDir;
LanguageLocales.Append(strdup(I18N_DEFAULT_LOCALE));
LanguageNames.Append(strdup(SkipContext(LanguageName)));
LanguageCodes.Append(strdup(LanguageCodeList[0]));

6
i18n.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: i18n.h 1.24 2007/08/24 13:35:18 kls Exp $
* $Id: i18n.h 1.25 2008/01/19 11:56:19 kls Exp $
*/
#ifndef __I18N_H
@ -19,8 +19,10 @@ typedef const char *tI18nPhrase[22]; ///< obsolete - switch to 'gettext'!
#define I18N_MAX_LOCALE_LEN 16 // for buffers that hold en_US etc.
#define I18N_MAX_LANGUAGES 256 // for buffers that hold all available languages
void I18nInitialize(void);
void I18nInitialize(const char *LocaleDir = NULL);
///< Detects all available locales and loads the language names and codes.
///< If LocaleDir is given, it must point to a static string that lives
///< for the entire lifetime of the program.
void I18nRegister(const char *Plugin);
///< Registers the named plugin, so that it can use internationalized texts.
void I18nSetLocale(const char *Locale);

17
vdr.c
View File

@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/vdr
*
* $Id: vdr.c 1.305 2008/01/13 11:51:53 kls Exp $
* $Id: vdr.c 1.306 2008/01/19 12:25:54 kls Exp $
*/
#include <getopt.h>
@ -198,6 +198,7 @@ int main(int argc, char *argv[])
bool MuteAudio = false;
int WatchdogTimeout = DEFAULTWATCHDOG;
const char *Terminal = NULL;
const char *LocaleDir = NULL;
bool UseKbd = true;
const char *LircDevice = NULL;
@ -229,6 +230,7 @@ int main(int argc, char *argv[])
{ "help", no_argument, NULL, 'h' },
{ "lib", required_argument, NULL, 'L' },
{ "lirc", optional_argument, NULL, 'l' | 0x100 },
{ "localedir",required_argument, NULL, 'l' | 0x200 },
{ "log", required_argument, NULL, 'l' },
{ "mute", no_argument, NULL, 'm' },
{ "no-kbd", no_argument, NULL, 'n' | 0x100 },
@ -306,6 +308,14 @@ int main(int argc, char *argv[])
case 'l' | 0x100:
LircDevice = optarg ? optarg : LIRC_DEVICE;
break;
case 'l' | 0x200:
if (access(optarg, R_OK | X_OK) == 0)
LocaleDir = optarg;
else {
fprintf(stderr, "vdr: can't access locale directory: %s\n", optarg);
return 2;
}
break;
case 'm': MuteAudio = true;
break;
case 'n' | 0x100:
@ -407,6 +417,8 @@ int main(int argc, char *argv[])
" -L DIR, --lib=DIR search for plugins in DIR (default is %s)\n"
" --lirc[=PATH] use a LIRC remote control device, attached to PATH\n"
" (default: %s)\n"
" --localedir=DIR search for locale files in DIR (default is\n"
" %s)\n"
" -m, --mute mute audio of the primary DVB device at startup\n"
" --no-kbd don't use the keyboard as an input device\n"
" -p PORT, --port=PORT use PORT for SVDRP (default: %d)\n"
@ -430,6 +442,7 @@ int main(int argc, char *argv[])
DEFAULTEPGDATAFILENAME,
DEFAULTPLUGINDIR,
LIRC_DEVICE,
LOCDIR,
DEFAULTSVDRPPORT,
RCU_DEVICE,
VideoDirectory,
@ -515,7 +528,7 @@ int main(int argc, char *argv[])
// Initialize internationalization:
I18nInitialize();
I18nInitialize(LocaleDir);
// Main program loop variables - need to be here to have them initialized before any EXIT():