mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
Added Language setting and localization wrapper
This commit is contained in:
36
plugins/libimhex/include/hex/helpers/lang.hpp
Normal file
36
plugins/libimhex/include/hex/helpers/lang.hpp
Normal 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user