#pragma once #include #include #include // Based on the code found in gettext.h, but without any additionall things we don't need. inline static const char *gettext_ctx(const char *ctx, const char *msgid) { const char *msg_ctxt_id = (std::string(ctx) + std::string("\004") + std::string(msgid)).c_str(); const char *translation = gettext(msg_ctxt_id); if (translation == msg_ctxt_id) { return msgid; } else { return translation; } } #define _TR(str) gettext(str) #define _TR_CTX(ctx, str) gettext_ctx(ctx, str) #define _TRS(str) std::string(_TR(str)) #define _TRS_CTX(ctx, str) std::string(_TR_CTX(ctx, str)) #define _TRIS(icon, str) (std::string(icon) + _TRS(str)) #define _TRI(icon, str) _TRIS(icon, str).c_str() #define _TRIS_CTX(icon, ctx, str) (std::string(icon) + _TRS_CTX(ctx, str)) #define _TRI_CTX(icon, ctx, str) _TRIS_CTX(icon, ctx, str).c_str() static std::string currentLanguage;