aboutsummaryrefslogtreecommitdiff
path: root/extension/src/LoadLocalisation.hpp
blob: f54a025778ab5df84a3eb1b1fb2f01e3f33d28b4 (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
#pragma once

#include <godot_cpp/core/class_db.hpp>
#include <godot_cpp/classes/translation.hpp>

namespace OpenVic2 {
   class LoadLocalisation : public godot::Object {

      GDCLASS(LoadLocalisation, godot::Object)

      static LoadLocalisation* singleton;

      godot::Error _load_file_into_translation(godot::String const& file_path, godot::Ref<godot::Translation> translation);
      godot::Ref<godot::Translation> _get_translation(godot::String const& locale);

   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);
      godot::Error load_locale_dir(godot::String const& dir_path, godot::String const& locale);
      godot::Error load_localisation_dir(godot::String const& dir_path);
   };
}