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

Support for custom text domain in module strings

parent 129717e2
...@@ -122,17 +122,18 @@ E_(vlc_entry) ( module_t *p_module ); ...@@ -122,17 +122,18 @@ E_(vlc_entry) ( module_t *p_module );
goto error; goto error;
#define set_shortname( shortname ) \ #define set_shortname( shortname ) \
if (vlc_module_set (p_submodule, VLC_MODULE_SHORTNAME, \ if (vlc_module_set (p_submodule, VLC_MODULE_SHORTNAME, domain, \
(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, \ if (vlc_module_set (p_submodule, VLC_MODULE_DESCRIPTION, domain, \
(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, (const char *)(help))) \ if (vlc_module_set (p_submodule, VLC_MODULE_HELP, domain, \
(const char *)(help))) \
goto error; goto error;
#define set_capability( cap, score ) \ #define set_capability( cap, score ) \
...@@ -162,16 +163,19 @@ enum vlc_module_properties ...@@ -162,16 +163,19 @@ enum vlc_module_properties
* Append new items at the end ONLY. */ * Append new items at the end ONLY. */
VLC_MODULE_CPU_REQUIREMENT, VLC_MODULE_CPU_REQUIREMENT,
VLC_MODULE_SHORTCUT, VLC_MODULE_SHORTCUT,
VLC_MODULE_SHORTNAME, VLC_MODULE_SHORTNAME_NODOMAIN,
VLC_MODULE_DESCRIPTION, VLC_MODULE_DESCRIPTION_NODOMAIN,
VLC_MODULE_HELP, VLC_MODULE_HELP_NODOMAIN,
VLC_MODULE_CAPABILITY, VLC_MODULE_CAPABILITY,
VLC_MODULE_SCORE, VLC_MODULE_SCORE,
VLC_MODULE_PROGRAM, VLC_MODULE_PROGRAM, /* obsoleted */
VLC_MODULE_CB_OPEN, VLC_MODULE_CB_OPEN,
VLC_MODULE_CB_CLOSE, VLC_MODULE_CB_CLOSE,
VLC_MODULE_NO_UNLOAD, VLC_MODULE_NO_UNLOAD,
VLC_MODULE_NAME, VLC_MODULE_NAME,
VLC_MODULE_SHORTNAME,
VLC_MODULE_DESCRIPTION,
VLC_MODULE_HELP,
}; };
enum vlc_config_properties enum vlc_config_properties
......
...@@ -108,17 +108,26 @@ int vlc_module_set (module_t *module, int propid, ...) ...@@ -108,17 +108,26 @@ int vlc_module_set (module_t *module, int propid, ...)
break; break;
} }
case VLC_MODULE_SHORTNAME: case VLC_MODULE_SHORTNAME_NODOMAIN:
module->psz_shortname = dgettext (PACKAGE, va_arg (ap, char *)); {
const char *name = va_arg (ap, char *);
ret = vlc_module_set (module, VLC_MODULE_SHORTNAME, NULL, name);
break; break;
}
case VLC_MODULE_DESCRIPTION: case VLC_MODULE_DESCRIPTION_NODOMAIN:
module->psz_longname = dgettext (PACKAGE, va_arg (ap, char *)); {
const char *desc = va_arg (ap, char *);
ret = vlc_module_set (module, VLC_MODULE_DESCRIPTION, NULL, desc);
break; break;
}
case VLC_MODULE_HELP: case VLC_MODULE_HELP_NODOMAIN:
module->psz_help = dgettext (PACKAGE, va_arg (ap, char *)); {
const char *help = va_arg (ap, char *);
ret = vlc_module_set (module, VLC_MODULE_HELP, NULL, help);
break; break;
}
case VLC_MODULE_CAPABILITY: case VLC_MODULE_CAPABILITY:
module->psz_capability = va_arg (ap, char *); module->psz_capability = va_arg (ap, char *);
...@@ -128,6 +137,10 @@ int vlc_module_set (module_t *module, int propid, ...) ...@@ -128,6 +137,10 @@ int vlc_module_set (module_t *module, int propid, ...)
module->i_score = va_arg (ap, int); module->i_score = va_arg (ap, int);
break; break;
case VLC_MODULE_PROGRAM:
msg_Warn (module, "deprecated module property %d", propid);
break;
case VLC_MODULE_CB_OPEN: case VLC_MODULE_CB_OPEN:
module->pf_activate = va_arg (ap, int (*) (vlc_object_t *)); module->pf_activate = va_arg (ap, int (*) (vlc_object_t *));
break; break;
...@@ -151,9 +164,32 @@ int vlc_module_set (module_t *module, int propid, ...) ...@@ -151,9 +164,32 @@ int vlc_module_set (module_t *module, int propid, ...)
break; break;
} }
case VLC_MODULE_PROGRAM: case VLC_MODULE_SHORTNAME:
msg_Warn (module, "deprecated module property %d", propid); {
const char *domain = va_arg (ap, const char *);
if (domain == NULL)
domain = PACKAGE;
module->psz_shortname = dgettext (domain, 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 = dgettext (domain, va_arg (ap, char *));
break; break;
}
case VLC_MODULE_HELP:
{
const char *domain = va_arg (ap, const char *);
if (domain == NULL)
domain = PACKAGE;
module->psz_help = dgettext (domain, va_arg (ap, char *));
break;
}
default: default:
msg_Err (module, "unknown module property %d", propid); msg_Err (module, "unknown module property %d", propid);
......
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