PipeWire 1.6.5

Loading...
Searching...
No Matches
i18n.h
Go to the documentation of this file.
1/* Simple Plugin API */
2/* SPDX-FileCopyrightText: Copyright © 2021 Wim Taymans */
3/* SPDX-License-Identifier: MIT */
4
5#ifndef SPA_I18N_H
6#define SPA_I18N_H
7
8#include <spa/utils/hook.h>
9#include <spa/utils/defs.h>
10
11#ifdef __cplusplus
12 extern "C" {
13#endif
14
15#ifndef SPA_API_I18N
16 #ifdef SPA_API_IMPL
17 #define SPA_API_I18N SPA_API_IMPL
18 #else
19 #define SPA_API_I18N static inline
20 #endif
21#endif
22
26
31
32#define SPA_TYPE_INTERFACE_I18N SPA_TYPE_INFO_INTERFACE_BASE "I18N"
33
34#define SPA_VERSION_I18N 0
35 struct spa_i18n { struct spa_interface iface; };
36
37 struct spa_i18n_methods {
38#define SPA_VERSION_I18N_METHODS 0
39 uint32_t version;
40
46 * \return a translated message
47 */
48 const char *(*text) (void *object, const char *msgid);
49
59 const char *(*ntext) (void *object, const char *msgid,
60 const char *msgid_plural, unsigned long int n);
61};
62
63 SPA_FORMAT_ARG_FUNC(2)
64 SPA_API_I18N const char *
65 spa_i18n_text(struct spa_i18n *i18n, const char *msgid)
66{
67 return spa_api_method_null_r(const char *, msgid, spa_i18n, i18n, &i18n->iface,
68 text, 0, msgid);
69}
70
71 SPA_API_I18N const char *
72 spa_i18n_ntext(struct spa_i18n *i18n, const char *msgid,
73 const char *msgid_plural, unsigned long int n)
74{
75 return spa_api_method_null_r(const char *, n == 1 ? msgid : msgid_plural,
76 spa_i18n, i18n, &i18n->iface, ntext, 0, msgid, msgid_plural, n);
77}
78
80
82
83#ifdef __cplusplus
84} /* extern "C" */
85#endif
86
87#endif /* SPA_I18N_H */
defs.h
spa/utils/defs.h
spa_i18n_ntext
SPA_API_I18N const char * spa_i18n_ntext(struct spa_i18n *i18n, const char *msgid, const char *msgid_plural, unsigned long int n)
Definition i18n.h:82
spa_i18n_text
SPA_API_I18N const char * spa_i18n_text(struct spa_i18n *i18n, const char *msgid)
Definition i18n.h:75
spa_api_method_null_r
#define spa_api_method_null_r(rtype, def, type, co, o, method, version,...)
Definition hook.h:308
SPA_FORMAT_ARG_FUNC
#define SPA_FORMAT_ARG_FUNC(arg1)
Definition defs.h:299
hook.h
spa/utils/hook.h
SPA_API_I18N
#define SPA_API_I18N
Definition i18n.h:26
spa_i18n_methods
Definition i18n.h:46
spa_i18n_methods::version
uint32_t version
Definition i18n.h:49
spa_i18n
Definition i18n.h:44
spa_i18n::iface
struct spa_interface iface
Definition i18n.h:44
spa_interface
Definition hook.h:148