Files
faumaray 5c036d91fb making WEB
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-11 00:45:17 +03:00

32 lines
1.1 KiB
C++

#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