🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
I18n.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24
25AST_NAMESPACE_BEGIN
26
33AST_UTIL_CAPI const char* aTextDomain(const char *domainname);
34
35
37AST_UTIL_CAPI const char* aGetText(const char* msgid);
38
42AST_UTIL_CAPI const char* aTranslate(const char* msgctxt, const char* msgid);
43
44//-----------------------
45// 与 Qt 兼容的函数接口
46//-----------------------
47
49A_ALWAYS_INLINE const char* tr(const char* msgid)
50{
51 return aGetText(msgid);
52}
53
54#ifndef QT_TR_NOOP
55 #define QT_TR_NOOP(String) String
56#endif
57
58#ifndef QT_TRANSLATE_NOOP
59 #define QT_TRANSLATE_NOOP(Context, String) String
60#endif
61
62//-----------------------
63// 与 libintl 兼容的函数接口
64//-----------------------
65
67A_ALWAYS_INLINE const char* gettext(const char* msgid)
68{
69 return aGetText(msgid);
70}
71
77A_ALWAYS_INLINE const char* pgettext(const char* msgctxt, const char* msgid)
78{
79 return aTranslate(msgctxt, msgid);
80}
81
83A_ALWAYS_INLINE const char* _(const char* msgid)
84{
85 return aGetText(msgid);
86}
87
88
89// 仅用于标记翻译字符串,不进行即时翻译
90#ifndef N_
91 #define N_(String) String
92#endif
93
94// 用于标记带上下文的翻译字符串,不进行即时翻译
95#ifndef NC_
96 #define NC_(Context, String) String
97#endif
98
99
101A_ALWAYS_INLINE const char* textdomain(const char* domainname)
102{
103 return aTextDomain(domainname);
104}
105
108AST_NAMESPACE_END
109
110
A_ALWAYS_INLINE const char * _(const char *msgid)
翻译文本
定义 I18n.hpp:83
const char * aGetText(const char *msgid)
获取翻译文本
定义 I18n.cpp:32
A_ALWAYS_INLINE const char * tr(const char *msgid)
获取翻译文本
定义 I18n.hpp:49
const char * aTranslate(const char *msgctxt, const char *msgid)
获取上下文翻译文本
定义 I18n.cpp:38
const char * aTextDomain(const char *domainname)
设置当前文本域
定义 I18n.cpp:26
A_ALWAYS_INLINE const char * gettext(const char *msgid)
获取翻译文本
定义 I18n.hpp:67
A_ALWAYS_INLINE const char * textdomain(const char *domainname)
设置当前文本域
定义 I18n.hpp:101
A_ALWAYS_INLINE const char * pgettext(const char *msgctxt, const char *msgid)
获取上下文文本 The letter 'p' stands for 'particular' or 'special'.
定义 I18n.hpp:77