PipeWire  1.4.5
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 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include <spa/utils/hook.h>
13 #include <spa/utils/defs.h>
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 
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 
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 
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 
83 #ifdef __cplusplus
84 } /* extern "C" */
85 #endif
86 
87 #endif /* SPA_I18N_H */
spa/utils/defs.h
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_API_I18N const char * spa_i18n_text(struct spa_i18n *i18n, const char *msgid)
Definition: i18n.h:75
#define spa_api_method_null_r(rtype, def, type, co, o, method, version,...)
Definition: hook.h:308
#define SPA_FORMAT_ARG_FUNC(arg1)
Definition: defs.h:297
spa/utils/hook.h
#define SPA_API_I18N
Definition: i18n.h:26
Definition: i18n.h:46
uint32_t version
Definition: i18n.h:49
Definition: i18n.h:44
struct spa_interface iface
Definition: i18n.h:44
Definition: hook.h:148