ES-DE/es-core/src/utils/LocalizationUtil.h

42 lines
1.2 KiB
C
Raw Normal View History

2024-06-29 19:24:28 +00:00
// SPDX-License-Identifier: MIT
//
// ES-DE Frontend
// LocalizationUtil.h
//
// Localization functions.
// Provides support for translations using gettext/libintl.
//
#ifndef ES_CORE_UTILS_LOCALIZATION_UTIL_H
#define ES_CORE_UTILS_LOCALIZATION_UTIL_H
#include <libintl.h>
#include <string>
#include <vector>
#define _(STR) std::string(gettext(STR))
#define _n(STR1, STR2, NUM) std::string(ngettext(STR1, STR2, NUM))
2024-07-23 16:17:44 +00:00
#define _p(STR1, STR2) Utils::Localization::pgettextBuiltin(STR1, STR2)
#define _np(STR1, STR2, STR3, NUM) Utils::Localization::npgettextBuiltin(STR1, STR2, STR3, NUM)
2024-06-29 19:24:28 +00:00
namespace Utils
{
namespace Localization
{
extern const std::vector<std::pair<std::string, std::string>> sSupportedLocales;
extern float sMenuTitleScaleFactor;
2024-06-29 19:24:28 +00:00
2024-07-23 16:17:44 +00:00
const char* pgettextBuiltin(const char* msgctxt, const char* msgid);
const char* npgettextBuiltin(const char* msgctxt,
const char* msgid1,
const char* msgid2,
unsigned long int n);
std::pair<std::string, std::string> getLocale();
void setLocale();
2024-06-29 19:24:28 +00:00
} // namespace Localization
} // namespace Utils
#endif // ES_CORE_UTILS_LOCALIZATION_UTIL_H