pipewire: add functions to get and set textdomain

This commit is contained in:
Wim Taymans 2021-04-14 18:16:06 +02:00
parent d44955a199
commit 646842098c
2 changed files with 22 additions and 1 deletions

View file

@ -75,7 +75,7 @@ struct support {
const char *plugin_dir; const char *plugin_dir;
const char *support_lib; const char *support_lib;
struct registry *registry; struct registry *registry;
const char *i18n_domain; char *i18n_domain;
struct spa_interface i18n_iface; struct spa_interface i18n_iface;
struct spa_support support[MAX_SUPPORT]; struct spa_support support[MAX_SUPPORT];
uint32_t n_support; uint32_t n_support;
@ -345,6 +345,24 @@ static void *add_interface(struct support *support,
return iface; return iface;
} }
SPA_EXPORT
int pw_set_domain(const char *domain)
{
struct support *support = &global_support;
free(support->i18n_domain);
if (domain == NULL)
support->i18n_domain = NULL;
else if ((support->i18n_domain = strdup(domain)) == NULL)
return -errno;
return 0;
}
SPA_EXPORT
const char *pw_get_domain(void)
{
struct support *support = &global_support;
return support->i18n_domain;
}
static const char *i18n_text(void *object, const char *msgid) static const char *i18n_text(void *object, const char *msgid)
{ {
struct support *support = object; struct support *support = object;

View file

@ -141,6 +141,9 @@ bool pw_in_valgrind(void);
enum pw_direction enum pw_direction
pw_direction_reverse(enum pw_direction direction); pw_direction_reverse(enum pw_direction direction);
int pw_set_domain(const char *domain);
const char *pw_get_domain(void);
uint32_t pw_get_support(struct spa_support *support, uint32_t max_support); uint32_t pw_get_support(struct spa_support *support, uint32_t max_support);
struct spa_handle *pw_load_spa_handle(const char *lib, struct spa_handle *pw_load_spa_handle(const char *lib,