Commit b1c38e81 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Don't run gettext while describing a plugin

This will render the plugins cache locale-independent.
parent cbe60054
......@@ -174,7 +174,6 @@ enum vlc_module_properties
__VLC_SYMBOL(vlc_entry) ( module_t *p_module ) \
{ \
module_config_t *p_config = NULL; \
const char *domain = NULL; \
if (vlc_module_set (p_module, VLC_MODULE_NAME, \
(const char *)(MODULE_STRING))) \
goto error; \
......@@ -206,17 +205,17 @@ enum vlc_module_properties
goto error;
#define set_shortname( shortname ) \
if (vlc_module_set (p_submodule, VLC_MODULE_SHORTNAME, domain, \
if (vlc_module_set (p_submodule, VLC_MODULE_SHORTNAME, \
(const char *)(shortname))) \
goto error;
#define set_description( desc ) \
if (vlc_module_set (p_submodule, VLC_MODULE_DESCRIPTION, domain, \
if (vlc_module_set (p_submodule, VLC_MODULE_DESCRIPTION, \
(const char *)(desc))) \
goto error;
#define set_help( help ) \
if (vlc_module_set (p_submodule, VLC_MODULE_HELP, domain, \
if (vlc_module_set (p_submodule, VLC_MODULE_HELP, \
(const char *)(help))) \
goto error;
......@@ -255,7 +254,7 @@ enum vlc_module_properties
#define add_typedesc_inner( type, text, longtext ) \
add_type_inner( type ) \
vlc_config_set (p_config, VLC_CONFIG_DESC, domain, \
vlc_config_set (p_config, VLC_CONFIG_DESC, \
(const char *)(text), (const char *)(longtext));
#define add_typeadv_inner( type, text, longtext, advc ) \
......@@ -402,14 +401,14 @@ enum vlc_module_properties
vlc_config_set (p_config, VLC_CONFIG_SHORTCUT, (int)(ch));
#define change_string_list( list, list_text, list_update_func ) \
vlc_config_set (p_config, VLC_CONFIG_LIST, domain, \
vlc_config_set (p_config, VLC_CONFIG_LIST, \
(size_t)(sizeof (list) / sizeof (char *)), \
(const char *const *)(list), \
(const char *const *)(list_text), \
(vlc_callback_t)(list_update_func));
#define change_integer_list( list, list_text, list_update_func ) \
vlc_config_set (p_config, VLC_CONFIG_LIST, domain, \
vlc_config_set (p_config, VLC_CONFIG_LIST, \
(size_t)(sizeof (list) / sizeof (int)), \
(const int *)(list), \
(const char *const *)(list_text), \
......@@ -423,7 +422,7 @@ enum vlc_module_properties
(double)(minv), (double)(maxv));
#define change_action_add( pf_action, text ) \
vlc_config_set (p_config, VLC_CONFIG_ADD_ACTION, domain, \
vlc_config_set (p_config, VLC_CONFIG_ADD_ACTION, \
(vlc_callback_t)(pf_action), (const char *)(text));
#define change_internal() \
......
......@@ -28,26 +28,10 @@
#include <assert.h>
#include <stdarg.h>
#ifdef ENABLE_NLS
# include <libintl.h>
#endif
#include "modules/modules.h"
#include "config/configuration.h"
#include "libvlc.h"
static const char *mdgettext (const char *domain, const char *msg)
{
assert (msg);
#ifdef ENABLE_NLS
if (*msg) /* Do not translate ""! */
return dgettext (domain, msg);
#else
VLC_UNUSED(domain);
#endif
return msg;
}
static void vlc_module_destruct (gc_object_t *obj)
{
module_t *module = vlc_priv (obj, module_t);
......@@ -242,31 +226,16 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
}
case VLC_MODULE_SHORTNAME:
{
const char *domain = va_arg (ap, const char *);
if (domain == NULL)
domain = PACKAGE;
module->psz_shortname = mdgettext (domain, va_arg (ap, char *));
module->psz_shortname = va_arg (ap, char *);
break;
}
case VLC_MODULE_DESCRIPTION:
{
const char *domain = va_arg (ap, const char *);
if (domain == NULL)
domain = PACKAGE;
module->psz_longname = mdgettext (domain, va_arg (ap, char *));
module->psz_longname = va_arg (ap, char *);
break;
}
case VLC_MODULE_HELP:
{
const char *domain = va_arg (ap, const char *);
if (domain == NULL)
domain = PACKAGE;
module->psz_help = mdgettext (domain, va_arg (ap, char *));
module->psz_help = va_arg (ap, char *);
break;
}
case VLC_CONFIG_NAME:
{
......@@ -369,21 +338,16 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
case VLC_CONFIG_DESC:
{
const char *domain = va_arg (ap, const char *);
const char *text = va_arg (ap, const char *);
const char *longtext = va_arg (ap, const char *);
if (domain == NULL)
domain = PACKAGE;
item->psz_text = text ? strdup (mdgettext (domain, text)) : NULL;
item->psz_longtext =
longtext ? strdup (mdgettext (domain, longtext)) : NULL;
item->psz_text = text ? strdup (text) : NULL;
item->psz_longtext = longtext ? strdup (longtext) : NULL;
break;
}
case VLC_CONFIG_LIST:
{
const char *domain = va_arg (ap, const char *);
size_t len = va_arg (ap, size_t);
/* Copy values */
......@@ -417,9 +381,6 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
break;
/* Copy textual descriptions */
if (domain == NULL)
domain = PACKAGE;
const char *const *text = va_arg (ap, const char *const *);
if (text != NULL)
{
......@@ -427,9 +388,7 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
if( dtext != NULL )
{
for (size_t i = 0; i < len; i++)
dtext[i] = text[i] ?
strdup (mdgettext( domain, text[i] )) :
NULL;
dtext[i] = text[i] ? strdup (text[i]) : NULL;
dtext[len] = NULL;
}
item->ppsz_list_text = dtext;
......@@ -444,7 +403,6 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
case VLC_CONFIG_ADD_ACTION:
{
const char *domain = va_arg (ap, const char *);
vlc_callback_t cb = va_arg (ap, vlc_callback_t), *tabcb;
const char *name = va_arg (ap, const char *);
char **tabtext;
......@@ -463,10 +421,8 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
break;
item->ppsz_action_text = tabtext;
if (domain == NULL)
domain = PACKAGE;
if (name)
tabtext[item->i_action] = strdup (mdgettext (domain, name));
tabtext[item->i_action] = strdup (name);
else
tabtext[item->i_action] = NULL;
tabtext[item->i_action + 1] = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment