mirror of
https://github.com/hax4dazy/TinWoo.git
synced 2025-02-09 19:25:05 +01:00
28 lines
588 B
C++
28 lines
588 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <sstream>
|
|
#include <fstream>
|
|
#include "json.hpp"
|
|
|
|
using json = nlohmann::json;
|
|
|
|
namespace Language {
|
|
void Load();
|
|
std::string LanguageEntry(std::string key);
|
|
std::string GetRandomMsg();
|
|
inline json GetRelativeJson(json j, std::string key) {
|
|
std::istringstream ss(key);
|
|
std::string token;
|
|
|
|
while (std::getline(ss, token, '.') && j != nullptr) {
|
|
j = j[token];
|
|
}
|
|
|
|
return j;
|
|
}
|
|
}
|
|
|
|
inline std::string operator ""_lang(const char* key, size_t size) {
|
|
return Language::LanguageEntry(std::string(key, size));
|
|
} |