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 ...@@ -174,7 +174,6 @@ enum vlc_module_properties
__VLC_SYMBOL(vlc_entry) ( module_t *p_module ) \ __VLC_SYMBOL(vlc_entry) ( module_t *p_module ) \
{ \ { \
module_config_t *p_config = NULL; \ module_config_t *p_config = NULL; \
const char *domain = NULL; \
if (vlc_module_set (p_module, VLC_MODULE_NAME, \ if (vlc_module_set (p_module, VLC_MODULE_NAME, \
(const char *)(MODULE_STRING))) \ (const char *)(MODULE_STRING))) \
goto error; \ goto error; \
...@@ -206,17 +205,17 @@ enum vlc_module_properties ...@@ -206,17 +205,17 @@ enum vlc_module_properties
goto error; goto error;
#define set_shortname( shortname ) \ #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))) \ (const char *)(shortname))) \
goto error; goto error;
#define set_description( desc ) \ #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))) \ (const char *)(desc))) \
goto error; goto error;
#define set_help( help ) \ #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))) \ (const char *)(help))) \
goto error; goto error;
...@@ -255,7 +254,7 @@ enum vlc_module_properties ...@@ -255,7 +254,7 @@ enum vlc_module_properties
#define add_typedesc_inner( type, text, longtext ) \ #define add_typedesc_inner( type, text, longtext ) \
add_type_inner( type ) \ 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)); (const char *)(text), (const char *)(longtext));
#define add_typeadv_inner( type, text, longtext, advc ) \ #define add_typeadv_inner( type, text, longtext, advc ) \
...@@ -402,14 +401,14 @@ enum vlc_module_properties ...@@ -402,14 +401,14 @@ enum vlc_module_properties
vlc_config_set (p_config, VLC_CONFIG_SHORTCUT, (int)(ch)); vlc_config_set (p_config, VLC_CONFIG_SHORTCUT, (int)(ch));
#define change_string_list( list, list_text, list_update_func ) \ #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 *)), \ (size_t)(sizeof (list) / sizeof (char *)), \
(const char *const *)(list), \ (const char *const *)(list), \
(const char *const *)(list_text), \ (const char *const *)(list_text), \
(vlc_callback_t)(list_update_func)); (vlc_callback_t)(list_update_func));
#define change_integer_list( list, list_text, 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)), \ (size_t)(sizeof (list) / sizeof (int)), \
(const int *)(list), \ (const int *)(list), \
(const char *const *)(list_text), \ (const char *const *)(list_text), \
...@@ -423,7 +422,7 @@ enum vlc_module_properties ...@@ -423,7 +422,7 @@ enum vlc_module_properties
(double)(minv), (double)(maxv)); (double)(minv), (double)(maxv));
#define change_action_add( pf_action, text ) \ #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)); (vlc_callback_t)(pf_action), (const char *)(text));
#define change_internal() \ #define change_internal() \
......
...@@ -28,26 +28,10 @@ ...@@ -28,26 +28,10 @@
#include <assert.h> #include <assert.h>
#include <stdarg.h> #include <stdarg.h>
#ifdef ENABLE_NLS
# include <libintl.h>
#endif
#include "modules/modules.h" #include "modules/modules.h"
#include "config/configuration.h" #include "config/configuration.h"
#include "libvlc.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) static void vlc_module_destruct (gc_object_t *obj)
{ {
module_t *module = vlc_priv (obj, module_t); 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, ...) ...@@ -242,31 +226,16 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
} }
case VLC_MODULE_SHORTNAME: case VLC_MODULE_SHORTNAME:
{ module->psz_shortname = va_arg (ap, char *);
const char *domain = va_arg (ap, const char *);
if (domain == NULL)
domain = PACKAGE;
module->psz_shortname = mdgettext (domain, va_arg (ap, char *));
break; break;
}
case VLC_MODULE_DESCRIPTION: case VLC_MODULE_DESCRIPTION:
{ module->psz_longname = va_arg (ap, char *);
const char *domain = va_arg (ap, const char *);
if (domain == NULL)
domain = PACKAGE;
module->psz_longname = mdgettext (domain, va_arg (ap, char *));
break; break;
}
case VLC_MODULE_HELP: case VLC_MODULE_HELP:
{ module->psz_help = va_arg (ap, char *);
const char *domain = va_arg (ap, const char *);
if (domain == NULL)
domain = PACKAGE;
module->psz_help = mdgettext (domain, va_arg (ap, char *));
break; break;
}
case VLC_CONFIG_NAME: case VLC_CONFIG_NAME:
{ {
...@@ -369,21 +338,16 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...) ...@@ -369,21 +338,16 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
case VLC_CONFIG_DESC: case VLC_CONFIG_DESC:
{ {
const char *domain = va_arg (ap, const char *);
const char *text = va_arg (ap, const char *); const char *text = va_arg (ap, const char *);
const char *longtext = va_arg (ap, const char *); const char *longtext = va_arg (ap, const char *);
if (domain == NULL) item->psz_text = text ? strdup (text) : NULL;
domain = PACKAGE; item->psz_longtext = longtext ? strdup (longtext) : NULL;
item->psz_text = text ? strdup (mdgettext (domain, text)) : NULL;
item->psz_longtext =
longtext ? strdup (mdgettext (domain, longtext)) : NULL;
break; break;
} }
case VLC_CONFIG_LIST: case VLC_CONFIG_LIST:
{ {
const char *domain = va_arg (ap, const char *);
size_t len = va_arg (ap, size_t); size_t len = va_arg (ap, size_t);
/* Copy values */ /* Copy values */
...@@ -417,9 +381,6 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...) ...@@ -417,9 +381,6 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
break; break;
/* Copy textual descriptions */ /* Copy textual descriptions */
if (domain == NULL)
domain = PACKAGE;
const char *const *text = va_arg (ap, const char *const *); const char *const *text = va_arg (ap, const char *const *);
if (text != NULL) if (text != NULL)
{ {
...@@ -427,9 +388,7 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...) ...@@ -427,9 +388,7 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
if( dtext != NULL ) if( dtext != NULL )
{ {
for (size_t i = 0; i < len; i++) for (size_t i = 0; i < len; i++)
dtext[i] = text[i] ? dtext[i] = text[i] ? strdup (text[i]) : NULL;
strdup (mdgettext( domain, text[i] )) :
NULL;
dtext[len] = NULL; dtext[len] = NULL;
} }
item->ppsz_list_text = dtext; item->ppsz_list_text = dtext;
...@@ -444,7 +403,6 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...) ...@@ -444,7 +403,6 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
case VLC_CONFIG_ADD_ACTION: case VLC_CONFIG_ADD_ACTION:
{ {
const char *domain = va_arg (ap, const char *);
vlc_callback_t cb = va_arg (ap, vlc_callback_t), *tabcb; vlc_callback_t cb = va_arg (ap, vlc_callback_t), *tabcb;
const char *name = va_arg (ap, const char *); const char *name = va_arg (ap, const char *);
char **tabtext; char **tabtext;
...@@ -463,10 +421,8 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...) ...@@ -463,10 +421,8 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
break; break;
item->ppsz_action_text = tabtext; item->ppsz_action_text = tabtext;
if (domain == NULL)
domain = PACKAGE;
if (name) if (name)
tabtext[item->i_action] = strdup (mdgettext (domain, name)); tabtext[item->i_action] = strdup (name);
else else
tabtext[item->i_action] = NULL; tabtext[item->i_action] = NULL;
tabtext[item->i_action + 1] = 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