2020-12-05 13:08:24 +01:00
|
|
|
#pragma once
|
2020-09-02 16:20:29 +02:00
|
|
|
|
2020-09-04 10:39:59 +02:00
|
|
|
#include "localized_string_id.h"
|
2025-10-15 22:10:02 +02:00
|
|
|
#include "Utilities/StrFmt.h"
|
2020-09-02 16:20:29 +02:00
|
|
|
|
2020-09-03 18:30:46 +02:00
|
|
|
std::string get_localized_string(localized_string_id id, const char* args = "");
|
|
|
|
|
std::u32string get_localized_u32string(localized_string_id id, const char* args = "");
|
2025-10-15 22:10:02 +02:00
|
|
|
|
|
|
|
|
template <typename CharT, usz N, typename... Args>
|
|
|
|
|
requires (sizeof...(Args) > 0)
|
|
|
|
|
std::string get_localized_string(localized_string_id id, const CharT(&fmt)[N], const Args&... args)
|
|
|
|
|
{
|
|
|
|
|
return get_localized_string(id, fmt::format(fmt, args...).c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct localized_string
|
|
|
|
|
{
|
|
|
|
|
template <typename CharT, usz N, typename... Args>
|
|
|
|
|
requires (sizeof...(Args) > 0)
|
|
|
|
|
localized_string(localized_string_id _id, const CharT(&fmt)[N], const Args&... args)
|
|
|
|
|
: id(_id), str(get_localized_string(id, fmt, args...))
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
localized_string_id id = localized_string_id::INVALID;
|
|
|
|
|
std::string str;
|
|
|
|
|
};
|