From bc0b3c61ae0b742da304cada451fba1df72bb0ad Mon Sep 17 00:00:00 2001 From: hop311 Date: Wed, 8 Nov 2023 22:24:21 +0000 Subject: GUI elements -> Godot UI nodes generator --- .../singletons/LoadLocalisation.hpp | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 extension/src/openvic-extension/singletons/LoadLocalisation.hpp (limited to 'extension/src/openvic-extension/singletons/LoadLocalisation.hpp') diff --git a/extension/src/openvic-extension/singletons/LoadLocalisation.hpp b/extension/src/openvic-extension/singletons/LoadLocalisation.hpp new file mode 100644 index 0000000..b093fdf --- /dev/null +++ b/extension/src/openvic-extension/singletons/LoadLocalisation.hpp @@ -0,0 +1,31 @@ +#pragma once + +#include + +#include + +namespace OpenVic { + class LoadLocalisation : public godot::Object { + GDCLASS(LoadLocalisation, godot::Object) + + static inline LoadLocalisation* _singleton = nullptr; + + godot::Error _load_file(godot::String const& file_path, godot::Ref translation) const; + godot::Ref _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; + + static bool add_message(std::string_view key, Dataloader::locale_t locale, std::string_view localisation); + }; +} -- cgit v1.2.3-56-ga3b1