1 parent
d146f11f02
commit
5c036d91fb
72 files changed
+5875
-1243
No files matched your search
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include <format>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace Echoion::Core::I18n
|
||||
{
|
||||
|
||||
// Languages the bot can reply in. English is the source language: every
|
||||
// English string in the code is a valid translation key, so English never
|
||||
// needs a table entry.
|
||||
enum class Language { English, Russian };
|
||||
|
||||
// Parse a language code ("en"/"ru", case-insensitive). Unknown codes fall
|
||||
// back to English so a bad config/kv value never breaks replies.
|
||||
Language parseLanguage(std::string_view code);
|
||||
|
||||
// The canonical code ("en"/"ru") — used as the kv_store / config value.
|
||||
std::string_view languageCode(Language lang);
|
||||
|
||||
// Human-readable, self-referential name ("English" / "Русский").
|
||||
std::string_view languageName(Language lang);
|
||||
|
||||
// Translate an English source string to `lang`. Returns the original string
|
||||
// unchanged when `lang` is English or no translation is registered, so a
|
||||
// missing entry degrades gracefully to English rather than to an empty
|
||||
// message.
|
||||
std::string_view translate(std::string_view english, Language lang);
|
||||
|
||||
} // namespace Echoion::Core::I18n
|
||||
Reference in new issue
Block a user