summaryrefslogtreecommitdiff
path: root/src/localization/localization.hpp
blob: d1ee2af6c2994867b87c71a1223f2c97f5bf98bb (plain)
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
#pragma once

#include <optional>
#include <string>
#include <unordered_map>
#include <vector>

#include "line_id.hpp"

namespace bot {
  namespace loc {
    class Localization {
      public:
        Localization(const std::string &folder_path);
        ~Localization() = default;

        std::optional<std::string> get_localized_line(
            const std::string &locale_id, const LineId &line_id);

        std::optional<std::string> get_formatted_line(
            const std::string &locale_id, const LineId &line_id,
            const std::vector<std::string> &args);

      private:
        std::unordered_map<LineId, std::string> load_from_file(
            const std::string &file_path);
        std::unordered_map<std::string, std::unordered_map<LineId, std::string>>
            localizations;
    };
  }

}