Added Language setting and localization wrapper

This commit is contained in:
WerWolv
2021-02-10 18:17:09 +01:00
parent a926b7b912
commit bd5da4a36e
9 changed files with 204 additions and 24 deletions

View File

@@ -0,0 +1,36 @@
#pragma once
#include <map>
#include <string>
#include <string_view>
namespace hex {
class LangEntry {
public:
LangEntry(const char *unlocalizedString);
operator std::string() const;
operator std::string_view() const;
operator const char*() const;
std::string_view get() const;
static void loadLanguage(std::string_view language);
static const std::map<std::string, std::string>& getSupportedLanguages();
private:
std::string m_unlocalizedString;
};
namespace lang_literals {
LangEntry operator""_lang(const char *string, size_t) {
return LangEntry(string);
}
}
}

View File

@@ -63,6 +63,7 @@ namespace hex {
static u32 patternPaletteOffset;
static std::string errorPopupMessage;
static std::list<ImHexApi::Bookmarks::Entry> bookmarkEntries;
static std::map<std::string, std::string> loadedLanguage;
static imgui_addons::ImGuiFileBrowser fileBrowser;
static imgui_addons::ImGuiFileBrowser::DialogMode fileBrowserDialogMode;