LeviLamina
Loading...
Searching...
No Matches
I18n.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/threading/Async.h"
7#include "mc/deps/core/utility/NonOwnerPointer.h"
8
9// auto generated forward declare list
10// clang-format off
11class I18nObserver;
12class Localization;
14class PackManifest;
17// clang-format on
18
19class I18n {
20public:
21 // I18n inner types declare
22 // clang-format off
23 class Property;
24 // clang-format on
25
26 // I18n inner types define
27 class Property {};
28
29public:
30 // virtual functions
31 // NOLINTBEGIN
32 virtual ~I18n() = default;
33
34 virtual void clearLanguages() = 0;
35
36 virtual ::std::vector<::std::string> findAvailableLanguages(::ResourcePackManager& resourcePackManager) = 0;
37
38 virtual ::std::unordered_map<::std::string, ::std::string>
39 findAvailableLanguageNames(::ResourcePackManager& resourcePackManager) = 0;
40
41 virtual ::Bedrock::Threading::Async<void> loadLanguages(
42 ::ResourcePackManager& resourcePackManager,
43 ::Bedrock::NotNullNonOwnerPtr<::ResourceLoadManager> resourceLoadManager,
44 ::std::string const& initLang
45 ) = 0;
46
47 virtual void loadAllLanguages(::ResourcePackManager& resourcePackManager) = 0;
48
49 virtual ::std::vector<::std::string> getLanguageCodesFromPack(::PackAccessStrategy const& accessStrategy) = 0;
50
51 virtual void
52 loadLanguageKeywordsFromPack(::PackManifest const& manifest, ::PackAccessStrategy const& accessStrategy) = 0;
53
54 virtual void loadLanguageKeywordsFromPack(
55 ::PackManifest const& manifest,
56 ::PackAccessStrategy const& accessStrategy,
57 ::std::vector<::std::string> const& languageCodes,
58 ::std::optional<::std::vector<::std::string>> const& additionalLocKeys
59 ) = 0;
60
61 virtual void appendLanguageStringsFromPack(
62 ::PackManifest const& manifest,
63 ::std::multimap<::std::string, ::std::pair<::std::string, ::std::string>> const& localizationMapping
64 ) = 0;
65
66 virtual ::std::unordered_map<::std::string, ::std::string>
67 getLanguageKeywordsFromPack(::PackManifest const& manifest, ::std::string const& keyword) = 0;
68
69 virtual void loadLangaugesByLocale(
70 ::std::unordered_multimap<::std::string, ::std::pair<::std::string, ::std::string>> const& storeLocalization
71 ) = 0;
72
73 virtual void appendAdditionalTranslations(
74 ::std::unordered_map<::std::string, ::std::string> const& translations,
75 ::std::string const& keyPrefix
76 ) = 0;
77
78 virtual void appendLanguageStrings(::PackAccessStrategy* accessStrategy) = 0;
79
80 virtual void addI18nObserver(::I18nObserver& observer) = 0;
81
82 virtual void chooseLanguage(::std::string const& code) = 0;
83
84 virtual ::std::string
85 get(::std::string const& id,
86 ::std::vector<::std::string> const& params,
87 ::std::shared_ptr<::Localization const> const locale) = 0;
88
89 virtual ::std::string
90 get(::std::string const& langString, ::std::shared_ptr<::Localization const> const locale) = 0;
91
92 virtual ::std::string getPackKeywordValue(::PackManifest const& manifest, ::std::string const& key) = 0;
93
94 virtual ::std::string getPackKeywordValueForTelemetry(::PackManifest const& manifest, ::std::string const& key) = 0;
95
96 virtual bool hasPackKeyEntry(::PackManifest const& manifest, ::std::string const& key) = 0;
97
98 virtual ::std::vector<::std::string> const& getSupportedLanguageCodes() = 0;
99
100 virtual ::std::string const& getLanguageName(::std::string const& code) = 0;
101
102 virtual ::std::shared_ptr<::Localization const> const getLocaleFor(::std::string const& code) = 0;
103
104 virtual ::std::string const& getLocaleCodeFor(::std::string const& code) = 0;
105
106 virtual ::gsl::not_null<::std::shared_ptr<::Localization const>> getCurrentLanguage() = 0;
107
108 virtual bool languageSupportsHypenSplitting() = 0;
109
110 virtual ::std::string
111 getLocalizedAssetFileWithFallback(::std::string const& fileNamePrefix, ::std::string const& fileNameSuffix) = 0;
112
113 virtual bool isPackKeyword(::std::string const& key) = 0;
114 // NOLINTEND
115};
116
117MCAPI I18n& getI18n();
Definition I18nObserver.h:13
Definition I18n.h:27
Definition I18n.h:19
Definition Localization.h:14
Definition PackAccessStrategy.h:25
Definition PackManifest.h:39
Definition ResourceLoadManager.h:18
Definition ResourcePackManager.h:36
Definition code.h:5