|
| | Localization () |
| |
| std::string_view | Translate (size_t pId) const |
| |
| std::string_view | Translate (auto lang, size_t pId) const |
| |
template<typename E >
requires std::is_enum_v<E> |
| std::string_view | Translate (E pId) const |
| |
template<typename E >
requires std::is_enum_v<E> |
| std::string_view | Translate (auto lang, E pId) const |
| |
template<typename Num >
requires std::is_integral_v<Num> && (!std::same_as<Num, size_t>) |
| std::string_view | Translate (Num pId) const |
| |
template<typename Num >
requires std::is_integral_v<Num> && (!std::same_as<Num, size_t>) |
| std::string_view | Translate (auto lang, Num pId) const |
| |
| void | AddTranslation (gwlanguage pLang, const char8_t *pText) |
| |
| template<typename... Args> |
| void | AddTranslation (gwlanguage pLang, Args &&... args) |
| |
| void | Load (gwlanguage pLang, const std::ranges::common_range auto &pRange) |
| |
| void | ChangeLanguage (gwlanguage pLang) |
| |
| template<typename... Args> |
| void | OverrideTranslation (gwlanguage pLanguage, size_t pTranslation, Args &&... args) |
| |
template<typename E , typename... Args>
requires std::is_enum_v<E> |
| void | OverrideTranslation (gwlanguage pLanguage, E pTranslation, Args &&... args) |
| |
template<typename Num , typename... Args>
requires std::is_integral_v<Num> && (!std::same_as<Num, size_t>) |
| void | OverrideTranslation (gwlanguage pLanguage, Num pTranslation, Args &&... args) |
| |
| | ~Singleton () override |
| |
| virtual | ~BaseSingleton ()=default |
| |
How to use:
Call Load() with your translations you want to add. Things are added to the back of the list with all Extension based translations at the beginning. So make sure, your IDs enum or whatever you use, starts with one higher than the last used one. Also make sure you add all 5 translations and they are of the same size. Call it within mod_init or as early as possible.
Call ChangeLanguage when you want to change the language. Call it once to setup the language the user has in mod_init