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