mirror of
https://github.com/oxen-io/oxen-core.git
synced 2023-12-14 02:22:56 +01:00
da400f6d66
This makes three big changes to how translation files are generated: - use Qt5 cmake built-in commands to do the translations rather than calling lrelease directly. lrelease is often not in the path, while Qt5 cmake knows how to find and invoke it. - Slam the resulting files into a C++ file using a cmake script rather than needing to compile a .c file to generate C++ file. This is simpler, but more importantly avoids the mess needed when cross compiling of having to import a cmake script from an external native build. - In the actual generated files, use an unordered_map rather than a massive list of static variable pointers.
17 lines
387 B
C++
17 lines
387 B
C++
#include <string>
|
|
#include <unordered_map>
|
|
|
|
using namespace std::literals;
|
|
|
|
static std::unordered_map<std::string, std::string> _translation_files{
|
|
@TRANSLATION_FILES@
|
|
};
|
|
|
|
bool find_embedded_file(const std::string &name, std::string &data) {
|
|
auto it = _translation_files.find(name);
|
|
if (it != _translation_files.end()) {
|
|
data = it->second;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|