blob: 9e39746bd69d106f7d3406eadc5a532960ec768c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#pragma once
#include <godot_cpp/classes/translation.hpp>
#include <openvic-simulation/dataloader/Dataloader.hpp>
namespace OpenVic {
class LoadLocalisation : public godot::Object {
GDCLASS(LoadLocalisation, godot::Object)
static inline LoadLocalisation* _singleton = nullptr;
godot::Ref<godot::Translation> translations[Dataloader::_LocaleCount];
godot::Error _load_file(godot::String const& file_path, godot::Ref<godot::Translation> const& translation) const;
godot::Ref<godot::Translation> _get_translation(godot::String const& locale) const;
protected:
static void _bind_methods();
public:
static LoadLocalisation* get_singleton();
LoadLocalisation();
~LoadLocalisation();
godot::Error load_file(godot::String const& file_path, godot::String const& locale) const;
godot::Error load_locale_dir(godot::String const& dir_path, godot::String const& locale) const;
godot::Error load_localisation_dir(godot::String const& dir_path) const;
bool add_message(std::string_view key, Dataloader::locale_t locale, std::string_view localisation);
};
}
|