20 lines
No EOL
947 B
C++
20 lines
No EOL
947 B
C++
#pragma once
|
|
#include <string>
|
|
// Based on the code found in gettext.h, but without any additional things we don't need.
|
|
const char *tr_ctx(const char *ctx, const char *msgid);
|
|
const char *tr(const char *msgid);
|
|
void setup_locale(const char *domain, const char *locale_dir = nullptr);
|
|
char *get_language();
|
|
void set_language(const char *language = nullptr);
|
|
#define _TR(str) tr(str)
|
|
#define _TR_CTX(ctx, str) tr_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()
|
|
#define CURRENT_LANGUAGE get_language()
|
|
// The value required to set the operating system's default language.
|
|
#define DEFAULT_LANG ""
|
|
#define SET_LANG(lang) set_language(lang) |