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 _replaceTokens(::std::string& string, ::std::vector<::std::string> const& params) const;
57
58 MCAPI void
59 _replaceUTCDateTimeIdentifier(::std::string& strToParse, ::std::optional<::std::locale> const& locale) const;
60
61 MCAPI void addKeys(::Localization&& from);
62
63 MCAPI void appendTranslations(
64 ::std::unordered_multimap<::std::string, ::std::pair<::std::string, ::std::string>> const& locStrings
65 );
66
67 MCAPI void appendTranslations(::Localization const& other);
68
69 MCAPI void appendTranslations(
70 ::std::string const& fileContent,
71 ::std::vector<::std::string> const& blockedKeys,
72 ::std::vector<::std::string> const& allowedKeys,
73 ::std::string const& keyPrefix
74 );
75
76 MCAPI bool get(::std::string const& id, ::std::string& out, ::std::vector<::std::string> const& params) const;
77
78 MCAPI void loadFromPack(
79 ::std::string const& keyPrefix,
80 ::PackAccessStrategy const& accessStrategy,
81 ::std::vector<::std::string> const& allowedKeys
82 );
83
84 MCAPI void loadFromResourcePackManager(
85 ::ResourcePackManager& resourcePackManager,
86 ::std::vector<::std::string> const& blockedKeys
87 );
88
89 MCAPI void replaceIdentifiers();
90
91 MCAPI ~Localization();
92 // NOLINTEND
93
94public:
95 // static functions
96 // NOLINTBEGIN
97 MCAPI static ::std::string _getDigitGroupSeparator(::std::string const& langCode);
98
99 MCAPI static bool _isCommaSeperatedLanguage(::std::string const& langCode);
100
101 MCAPI_C static ::Core::PathBuffer<::std::string> getLangFilePath(::std::string const& langCode);
102
103 MCAPI static ::std::string getLanguageCode(::std::string const& fullCode);
104 // NOLINTEND
105
106public:
107 // constructor thunks
108 // NOLINTBEGIN
109 MCAPI void* $ctor(::Localization&&);
110
111 MCAPI void* $ctor(::std::string const& code);
112
113 MCAPI void* $ctor(::Localization const& rhs);
114
115 MCAPI void* $ctor(::std::string const& code, ::Localization const* fallbackLocale);
116 // NOLINTEND
117
118public:
119 // destructor thunk
120 // NOLINTBEGIN
121 MCAPI void $dtor();
122 // NOLINTEND
123};
Definition PackAccessStrategy.h:21
Definition ResourcePackManager.h:29
Definition OptionalString.h:5
Definition code.h:5