~aleteoryx/muditaos

ref: de5b923e81ed56bc845b75b2833cb040fafc3409 muditaos/module-utils/i18n/i18n.hpp -rw-r--r-- 1.2 KiB
de5b923e — DariuszSabala [BH-369] Turned UTF8 into separate library 4 years ago
                                                                                
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
34
35
36
37
38
39
40
41
42
43
44
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <string>
#include <filesystem>
#include <vector>

using Language = std::string;

namespace utils
{
    namespace files
    {
        constexpr auto jsonExtension = ".json";
        constexpr auto breakSign     = "_";
    } // namespace files

    class LangLoader
    {
      public:
        virtual ~LangLoader() = default;
        std::vector<Language> getAvailableDisplayLanguages() const;
        std::vector<Language> getAvailableInputLanguages() const;
    };

    const std::string &translate(const std::string &text);
    const std::string &getDisplayLanguage();
    const std::string &getInputLanguageFilename(const std::string &inputMode);

    bool setInputLanguage(const Language &lang);
    bool setDisplayLanguage(const Language &lang);
    void resetDisplayLanguages();

    const std::filesystem::path getInputLanguagePath();
    const std::filesystem::path getDisplayLanguagePath();

    constexpr auto getDefaultLanguage()
    {
        return "English";
    }
    void resetAssetsPath(const std::filesystem::path &);
} // namespace utils