LeviLamina
Loading...
Searching...
No Matches
Localization.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/file/PathBuffer.h"
7
8// auto generated forward declare list
9// clang-format off
11struct OptionalString;
12// clang-format on
13
14class Localization {
15public:
16 // Localization inner types define
17 using Map = ::std::map<::std::string, ::std::string>;
18
19 using StoreLocMap = ::std::unordered_multimap<::std::string, ::std::pair<::std::string, ::std::string>>;
20
21public:
22 // member variables
23 // NOLINTBEGIN
24 ::ll::TypedStorage<1, 1, bool const> mCommaSeperator;
25 ::ll::TypedStorage<8, 32, ::std::string const> mDigitGroupSeparator;
26 ::ll::TypedStorage<8, 32, ::std::string const> mCode;
27 ::ll::TypedStorage<8, 16, ::std::map<::std::string, ::std::string>> mStrings;
28 ::ll::TypedStorage<8, 16, ::std::map<::std::string, ::std::string>> mCaseSensitiveCache;
29 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::std::shared_mutex>> mCaseSensitiveCacheMutex;
30 ::ll::TypedStorage<1, 1, bool> mMayContainIdentifier;
31 // NOLINTEND
32
33public:
34 // prevent constructor by default
35 Localization& operator=(Localization const&);
36 Localization();
37
38public:
39 // member functions
40 // NOLINTBEGIN
41 MCAPI explicit Localization(::std::string const& code);
42
43 MCAPI Localization(::Localization&& rhs);
44
45 MCAPI Localization(::Localization const& rhs);
46
47 MCAPI Localization(::std::string const& code, ::Localization const* fallbackLocale);
48
49#ifdef LL_PLAT_C
50 MCAPI ::OptionalString _get(::std::string const& id, ::std::vector<::std::string> const& params) const;
51#endif
52
53 MCAPI ::OptionalString _getSimple(::std::string const& id) const;
54
55 MCAPI void addKeys(::Localization&& from);
56
57 MCAPI void appendTranslations(::Localization const& other);
58
59 MCAPI void appendTranslations(
60 ::std::string const& fileContent,
61 ::std::vector<::std::string> const& blockedKeys,
62 ::std::vector<::std::string> const& allowedKeys,
63 ::std::string const& keyPrefix
64 );
65
66 MCAPI bool get(::std::string const& id, ::std::string& out, ::std::vector<::std::string> const& params) const;
67
68#ifdef LL_PLAT_C
69 MCFOLD ::std::string const getDigitGroupSeparator() const;
70#endif
71
72 MCFOLD ::std::string getFullLanguageCode() const;
73
74#ifdef LL_PLAT_C
75 MCAPI ::std::string getIETFLanguageCode() const;
76#endif
77
78 MCAPI void loadFromResourcePackManager(
79 ::ResourcePackManager& resourcePackManager,
80 ::std::vector<::std::string> const& blockedKeys
81 );
82
83 MCAPI ~Localization();
84 // NOLINTEND
85
86public:
87 // static functions
88 // NOLINTBEGIN
89#ifdef LL_PLAT_C
90 MCAPI static ::std::string _getDigitGroupSeparator(::std::string const& langCode);
91#endif
92
93#ifdef LL_PLAT_S
94 MCAPI static ::std::string _getDigitGroupSeparator(::std::string const& langCode);
95#endif
96
97#ifdef LL_PLAT_C
98 MCAPI static bool _isCommaSeperatedLanguage(::std::string const& langCode);
99#endif
100
101#ifdef LL_PLAT_S
102 MCAPI static bool _isCommaSeperatedLanguage(::std::string const& langCode);
103#endif
104
105 MCAPI static ::Core::PathBuffer<::std::string> getLangFilePath(::std::string const& langCode);
106
107#ifdef LL_PLAT_C
108 MCAPI static ::std::string getLanguageCode(::std::string const& fullCode);
109
110 MCAPI static ::std::string getRegionCode(::std::string const& fullCode);
111
112 MCAPI static void replaceTokens(::std::string& string, ::std::vector<::std::string> const& params);
113#endif
114 // NOLINTEND
115
116public:
117 // constructor thunks
118 // NOLINTBEGIN
119 MCAPI void* $ctor(::std::string const& code);
120
121 MCAPI void* $ctor(::Localization&& rhs);
122
123 MCAPI void* $ctor(::Localization const& rhs);
124
125 MCAPI void* $ctor(::std::string const& code, ::Localization const* fallbackLocale);
126 // NOLINTEND
127
128public:
129 // destructor thunk
130 // NOLINTBEGIN
131 MCAPI void $dtor();
132 // NOLINTEND
133};
Definition ResourcePackManager.h:36
Definition OptionalString.h:5
Definition code.h:5