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

modules: move text domain to plugin

Separate text domains for modules in the same library would not make
much sense, and it was never supported.
parent ca6e1713
......@@ -57,7 +57,7 @@
#ifdef HAVE_DYNAMIC_PLUGINS
/* Sub-version number
* (only used to avoid breakage in dev version when cache structure changes) */
#define CACHE_SUBVERSION_NUM 27
#define CACHE_SUBVERSION_NUM 28
/* Cache filename */
#define CACHE_NAME "plugins.dat"
......@@ -314,10 +314,6 @@ static module_t *vlc_cache_load_module(vlc_plugin_t *plugin, block_t *file)
LOAD_IMMEDIATE(module->i_score);
LOAD_IMMEDIATE(module->b_unloadable);
LOAD_STRING(module->domain);
if (module->domain != NULL)
vlc_bindtextdomain (module->domain);
uint32_t submodules;
LOAD_IMMEDIATE(submodules);
......@@ -362,6 +358,8 @@ static vlc_plugin_t *vlc_cache_load_plugin(block_t *file)
if (vlc_cache_load_plugin_config(plugin, file))
goto error;
LOAD_STRING(plugin->textdomain);
const char *path;
LOAD_STRING(path);
if (path == NULL)
......@@ -373,6 +371,10 @@ static vlc_plugin_t *vlc_cache_load_plugin(block_t *file)
LOAD_IMMEDIATE(plugin->mtime);
LOAD_IMMEDIATE(plugin->size);
if (plugin->textdomain != NULL)
vlc_bindtextdomain(plugin->textdomain);
return plugin;
error:
......@@ -650,8 +652,6 @@ static int CacheSaveBank(FILE *file, vlc_plugin_t *const *cache, size_t n)
SAVE_IMMEDIATE(module->i_score);
SAVE_IMMEDIATE(module->b_unloadable);
SAVE_STRING(module->domain);
i_submodule = module->submodule_count;
SAVE_IMMEDIATE( i_submodule );
if (CacheSaveSubmodule (file, module->submodule))
......@@ -662,6 +662,7 @@ static int CacheSaveBank(FILE *file, vlc_plugin_t *const *cache, size_t n)
goto error;
/* Save common info */
SAVE_STRING(plugin->textdomain);
SAVE_STRING(plugin->path);
SAVE_IMMEDIATE(plugin->mtime);
SAVE_IMMEDIATE(plugin->size);
......
......@@ -69,7 +69,6 @@ module_t *vlc_module_create(vlc_plugin_t *plugin)
module->pf_deactivate = NULL;
/*module->handle = garbage */
module->psz_filename = NULL;
module->domain = NULL;
return module;
}
......@@ -99,7 +98,7 @@ vlc_plugin_t *vlc_plugin_create(void)
plugin->path = NULL;
plugin->module = NULL;
plugin->textdomain = NULL;
plugin->conf.items = NULL;
plugin->conf.size = 0;
plugin->conf.count = 0;
......@@ -297,9 +296,8 @@ static int vlc_plugin_setter(void *ctx, void *tgt, int propid, ...)
break;
case VLC_MODULE_TEXTDOMAIN:
assert(module->plugin->module == NULL);
assert (module->domain == NULL);
module->domain = va_arg (ap, const char *);
assert(plugin->textdomain == NULL);
plugin->textdomain = va_arg(ap, const char *);
break;
case VLC_CONFIG_NAME:
......
......@@ -127,12 +127,10 @@ int module_get_score( const module_t *m )
*/
const char *module_gettext (const module_t *m, const char *str)
{
m = m->plugin->module;
if (unlikely(str == NULL || *str == '\0'))
return "";
#ifdef ENABLE_NLS
const char *domain = m->domain;
const char *domain = m->plugin->textdomain;
return dgettext ((domain != NULL) ? domain : PACKAGE_NAME, str);
#else
(void)m;
......
......@@ -35,6 +35,8 @@ typedef struct vlc_plugin_t
module_t *module;
const char *textdomain; /**< gettext domain (or NULL) */
/**
* Variables set by the module to store its config options
*/
......@@ -100,7 +102,6 @@ struct module_t
/* Plugin-specific stuff */
module_handle_t handle; /* Unique handle */
char * psz_filename; /* Module filename */
const char * domain; /* gettext domain */
};
vlc_plugin_t *vlc_plugin_create(void);
......
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