+ +
2da5fe7 OpenAVX v0.2.0 - High-performance open-standard IP audio and video transport suite
saifmukhtar · 2026-11-24
main
| 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 | |
| 23 | /** \defgroup spa_i18n I18N |
| 24 | * Gettext interface |
| 25 | */ |
| 26 | |
| 27 | /** |
| 28 | * \addtogroup spa_i18n |
| 29 | * \{ |
| 30 | */ |
| 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 | |
| 41 | /** |
| 42 | * Translate a message |
| 43 | * |
| 44 | * \param object the i18n interface |
| 45 | * \param msgid the message |
| 46 | * \return a translated message |
| 47 | */ |
| 48 | const char *(*text) (void *object, const char *msgid); |
| 49 | |
| 50 | /** |
| 51 | * Translate a message for a number |
| 52 | * |
| 53 | * \param object the i18n interface |
| 54 | * \param msgid the message to translate |
| 55 | * \param msgid_plural the plural form of \a msgid |
| 56 | * \param n a number |
| 57 | * \return a translated message for the number \a n |
| 58 | */ |
| 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 | |
| 79 | /** |
| 80 | * \} |
| 81 | */ |
| 82 | |
| 83 | #ifdef __cplusplus |
| 84 | } /* extern "C" */ |
| 85 | #endif |
| 86 | |
| 87 | #endif /* SPA_I18N_H */ |