🛰️航天仿真算法库 SpaceAST 0.3.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
48A_ALWAYS_INLINE const char* translate(const char* msgctxt, const char* msgid)
49{
50 return aTranslate(msgctxt, msgid);
51}
52
53// 仅用于标记翻译字符串,不进行即时翻译(仅在class中有效,自动提取class名称作为上下文)
54#define AST_TR_NOOP(String) String
55
56// 仅用于标记带上下文的翻译字符串,不进行即时翻译
57#define AST_TRANSLATE_NOOP(Context, String) String
58
59#ifndef QT_TR_NOOP
60 #define QT_TR_NOOP(String) AST_TR_NOOP(String)
61#endif
62
63#ifndef QT_TRANSLATE_NOOP
64 #define QT_TRANSLATE_NOOP(Context, String) AST_TRANSLATE_NOOP(Context, String)
65#endif
66
67//-----------------------
68// 与 libintl 兼容的函数接口
69//-----------------------
70
72A_ALWAYS_INLINE const char* gettext(const char* msgid)
73{
74 return aGetText(msgid);
75}
76
82A_ALWAYS_INLINE const char* pgettext(const char* msgctxt, const char* msgid)
83{
84 return aTranslate(msgctxt, msgid);
85}
86
88A_ALWAYS_INLINE const char* _(const char* msgid)
89{
90 return aGetText(msgid);
91}
92
94A_ALWAYS_INLINE const char* C_(const char* msgctxt, const char* msgid)
95{
96 return aTranslate(msgctxt, msgid);
97}
98
99// 仅用于标记翻译字符串,不进行即时翻译(无上下文)
100#ifndef N_
101 #define N_(String) String
102#endif
103
104// 用于标记带上下文的翻译字符串,不进行即时翻译
105#ifndef NC_
106 #define NC_(Context, String) String
107#endif
108
109
111A_ALWAYS_INLINE const char* textdomain(const char* domainname)
112{
113 return aTextDomain(domainname);
114}
115
118AST_NAMESPACE_END
119
120
A_ALWAYS_INLINE const char * _(const char *msgid)
翻译文本(无上下文)
定义 I18n.hpp:88
const char * aGetText(const char *msgid)
获取翻译文本(无上下文)
定义 I18n.cpp:32
const char * aTranslate(const char *msgctxt, const char *msgid)
给定上下文,获取翻译文本
定义 I18n.cpp:37
const char * aTextDomain(const char *domainname)
设置当前文本域(尚未实现)
定义 I18n.cpp:26
A_ALWAYS_INLINE const char * gettext(const char *msgid)
获取翻译文本(无上下文)
定义 I18n.hpp:72
A_ALWAYS_INLINE const char * textdomain(const char *domainname)
设置当前文本域
定义 I18n.hpp:111
A_ALWAYS_INLINE const char * C_(const char *msgctxt, const char *msgid)
翻译文本(带上下文信息)
定义 I18n.hpp:94
A_ALWAYS_INLINE const char * pgettext(const char *msgctxt, const char *msgid)
给定上下文,获取翻译文本 The letter 'p' stands for 'particular' or 'special'.
定义 I18n.hpp:82