Skip to content
LeviMC
English
AutoLightDark
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 MCNAPI explicit Localization(::std::string const& code);
43
44 MCNAPI Localization(::Localization&& rhs);
45
46 MCNAPI Localization(::Localization const& rhs);
47
48 MCNAPI 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 MCNAPI void addKeys(::Localization&& from);
55
56 MCNAPI void appendTranslations(
57 ::std::unordered_multimap<::std::string, ::std::pair<::std::string, ::std::string>> const& locStrings
58 );
59
60 MCNAPI void appendTranslations(::Localization const& other);
61
62 MCNAPI void appendTranslations(
63 ::std::string const& fileContent,
64 ::std::vector<::std::string> const& blockedKeys,
65 ::std::vector<::std::string> const& allowedKeys,
66 ::std::string const& keyPrefix
67 );
68
69 MCAPI bool get(::std::string const& id, ::std::string& out, ::std::vector<::std::string> const& params) const;
70
71#ifdef LL_PLAT_C
72 MCNAPI ::std::string const getDigitGroupSeparator() const;
73#endif
74
75 MCFOLD ::std::string getFullLanguageCode() const;
76
77#ifdef LL_PLAT_C
78 MCNAPI ::std::string getIETFLanguageCode() const;
79#endif
80
81 MCNAPI void loadFromPack(
82 ::std::string const& keyPrefix,
83 ::PackAccessStrategy const& accessStrategy,
84 ::std::vector<::std::string> const& allowedKeys
85 );
86
88 ::ResourcePackManager& resourcePackManager,
89 ::std::vector<::std::string> const& blockedKeys
90 );
91
92 MCNAPI void replaceIdentifiers();
93
94 MCNAPI ~Localization();
95 // NOLINTEND
96
97public:
98 // static functions
99 // NOLINTBEGIN
100 MCNAPI static ::std::string _getDigitGroupSeparator(::std::string const& langCode);
101
102 MCNAPI static bool _isCommaSeperatedLanguage(::std::string const& langCode);
103
104 MCNAPI static ::Core::PathBuffer<::std::string> getLangFilePath(::std::string const& langCode);
105
106 MCNAPI static ::std::string getLanguageCode(::std::string const& fullCode);
107
108#ifdef LL_PLAT_C
109 MCNAPI static ::std::string getRegionCode(::std::string const& fullCode);
110
111 MCNAPI static void replaceTokens(::std::string& string, ::std::vector<::std::string> const& params);
112#endif
113 // NOLINTEND
114
115public:
116 // constructor thunks
117 // NOLINTBEGIN
118 MCNAPI void* $ctor(::std::string const& code);
119
120 MCNAPI void* $ctor(::Localization&& rhs);
121
122 MCNAPI void* $ctor(::Localization const& rhs);
123
124 MCNAPI void* $ctor(::std::string const& code, ::Localization const* fallbackLocale);
125 // NOLINTEND
126
127public:
128 // destructor thunk
129 // NOLINTBEGIN
130 MCNAPI void $dtor();
131 // NOLINTEND
132};
static MCAPI ::Core::PathBuffer<::std::string > getLangFilePath(::std::string const &langCode)
static MCAPI ::std::string getLanguageCode(::std::string const &fullCode)
MCAPI Localization(::std::string const &code, ::Localization const *fallbackLocale)
MCAPI void loadFromResourcePackManager(::ResourcePackManager &resourcePackManager, ::std::vector<::std::string > const &blockedKeys)
MCAPI void * $ctor(::std::string const &code, ::Localization const *fallbackLocale)
MCAPI Localization(::Localization const &rhs)
MCAPI void appendTranslations(::std::unordered_multimap<::std::string, ::std::pair<::std::string, ::std::string > > const &locStrings)
MCAPI void appendTranslations(::std::string const &fileContent, ::std::vector<::std::string > const &blockedKeys, ::std::vector<::std::string > const &allowedKeys, ::std::string const &keyPrefix)
MCAPI void replaceIdentifiers()
static MCAPI ::std::string _getDigitGroupSeparator(::std::string const &langCode)
MCAPI void $dtor()
static MCAPI bool _isCommaSeperatedLanguage(::std::string const &langCode)
MCAPI Localization(::Localization &&rhs)
MCAPI void * $ctor(::Localization &&rhs)
MCAPI void * $ctor(::Localization const &rhs)
MCAPI void appendTranslations(::Localization const &other)
MCAPI ~Localization()
MCAPI void * $ctor(::std::string const &code)
MCAPI Localization(::std::string const &code)
MCAPI void loadFromPack(::std::string const &keyPrefix, ::PackAccessStrategy const &accessStrategy, ::std::vector<::std::string > const &allowedKeys)
MCAPI void addKeys(::Localization &&from)
Definition PackAccessStrategy.h:25
Definition ResourcePackManager.h:29
Definition OptionalString.h:5
Definition code.h:5