🛰️航天仿真算法库 SpaceAST 0.4.0
载入中...
搜索中...
未找到
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//-----------------------
60// 与 libintl 兼容的函数接口
61//-----------------------
62
64A_ALWAYS_INLINE const char* gettext(const char* msgid)
65{
66 return aGetText(msgid);
67}
68
74A_ALWAYS_INLINE const char* pgettext(const char* msgctxt, const char* msgid)
75{
76 return aTranslate(msgctxt, msgid);
77}
78
80A_ALWAYS_INLINE const char* _(const char* msgid)
81{
82 return aGetText(msgid);
83}
84
86A_ALWAYS_INLINE const char* C_(const char* msgctxt, const char* msgid)
87{
88 return aTranslate(msgctxt, msgid);
89}
90
91// 仅用于标记翻译字符串,不进行即时翻译(无上下文)
92#ifndef N_
93 #define N_(String) String
94#endif
95
96// 用于标记带上下文的翻译字符串,不进行即时翻译
97#ifndef NC_
98 #define NC_(Context, String) String
99#endif
100
101
103A_ALWAYS_INLINE const char* textdomain(const char* domainname)
104{
105 return aTextDomain(domainname);
106}
107
110AST_NAMESPACE_END
111
112
A_ALWAYS_INLINE const char * _(const char *msgid)
翻译文本(无上下文)
定义 I18n.hpp:80
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:64
A_ALWAYS_INLINE const char * textdomain(const char *domainname)
设置当前文本域
定义 I18n.hpp:103
A_ALWAYS_INLINE const char * C_(const char *msgctxt, const char *msgid)
翻译文本(带上下文信息)
定义 I18n.hpp:86
A_ALWAYS_INLINE const char * pgettext(const char *msgctxt, const char *msgid)
给定上下文,获取翻译文本 The letter 'p' stands for 'particular' or 'special'.
定义 I18n.hpp:74