fix: fix I18nAPI.get
This commit is contained in:
+7
-3
@@ -19,6 +19,7 @@ const GMLIB_API = {
|
|||||||
setPlayerNbt: ll.import("GMLIB_API", "setPlayerNbt"),
|
setPlayerNbt: ll.import("GMLIB_API", "setPlayerNbt"),
|
||||||
setPlayerNbtTags: ll.import("GMLIB_API", "setPlayerNbtTags"),
|
setPlayerNbtTags: ll.import("GMLIB_API", "setPlayerNbtTags"),
|
||||||
resourcePackTranslate: ll.import("GMLIB_API", "resourcePackTranslate"),
|
resourcePackTranslate: ll.import("GMLIB_API", "resourcePackTranslate"),
|
||||||
|
resourcePackDefaultTranslate: ll.import("GMLIB_API", "resourcePackDefaultTranslate"),
|
||||||
getResourcePackI18nLanguage: ll.import("GMLIB_API", "getResourcePackI18nLanguage"),
|
getResourcePackI18nLanguage: ll.import("GMLIB_API", "getResourcePackI18nLanguage"),
|
||||||
chooseResourcePackI18nLanguage: ll.import("GMLIB_API", "chooseResourcePackI18nLanguage"),
|
chooseResourcePackI18nLanguage: ll.import("GMLIB_API", "chooseResourcePackI18nLanguage"),
|
||||||
setEducationFeatureEnabled: ll.import("GMLib_ServerAPI", "setEducationFeatureEnabled"),
|
setEducationFeatureEnabled: ll.import("GMLib_ServerAPI", "setEducationFeatureEnabled"),
|
||||||
@@ -812,8 +813,11 @@ class I18nAPI {
|
|||||||
throw new Error("Static class cannot be instantiated");
|
throw new Error("Static class cannot be instantiated");
|
||||||
}
|
}
|
||||||
|
|
||||||
static get(key, params = []) {
|
static get(key, params = [], langCode = undefined) {
|
||||||
GMLIB_API.resourcePackTranslate(key, params);
|
if (langCode) {
|
||||||
|
return GMLIB_API.resourcePackTranslate(key, params, langCode);
|
||||||
|
}
|
||||||
|
return GMLIB_API.resourcePackDefaultTranslate(key, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
static translate(key, params = []) {
|
static translate(key, params = []) {
|
||||||
@@ -840,7 +844,7 @@ class I18nAPI {
|
|||||||
GMLIB_API.updateOrCreateLanguageFile(code, lang, path);
|
GMLIB_API.updateOrCreateLanguageFile(code, lang, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static loadLanguagePath(path) {
|
static loadLanguageDirectory(path) {
|
||||||
GMLIB_API.loadLanguagePath(path);
|
GMLIB_API.loadLanguagePath(path);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "${pluginName}",
|
"name": "${pluginName}",
|
||||||
"entry": "${pluginFile}",
|
"entry": "${pluginFile}",
|
||||||
"version": "0.12.3",
|
"version": "0.12.4",
|
||||||
"author": "GroupMountain",
|
"author": "GroupMountain",
|
||||||
"type": "native",
|
"type": "native",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
|||||||
@@ -161,9 +161,16 @@ void Export_Compatibility_API() {
|
|||||||
});
|
});
|
||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLIB_API",
|
"GMLIB_API",
|
||||||
"resourcePackTranslate",
|
"resourcePackDefaultTranslate",
|
||||||
[](std::string key, std::vector<std::string> params) -> std::string { return I18nAPI::get(key, params); }
|
[](std::string key, std::vector<std::string> params) -> std::string { return I18nAPI::get(key, params); }
|
||||||
);
|
);
|
||||||
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"resourcePackTranslate",
|
||||||
|
[](std::string key, std::vector<std::string> params, std::string code) -> std::string {
|
||||||
|
return I18nAPI::get(key, params, code);
|
||||||
|
}
|
||||||
|
);
|
||||||
RemoteCall::exportAs("GMLIB_API", "chooseResourcePackI18nLanguage", [](std::string code) -> void {
|
RemoteCall::exportAs("GMLIB_API", "chooseResourcePackI18nLanguage", [](std::string code) -> void {
|
||||||
if (GMLIB_Level::getInstance()) {
|
if (GMLIB_Level::getInstance()) {
|
||||||
I18nAPI::chooseLanguage(code);
|
I18nAPI::chooseLanguage(code);
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#define PLUGIN_NAME fmt::format(fg(fmt::color::light_green), "GMLIB-LRCA")
|
#define PLUGIN_NAME fmt::format(fg(fmt::color::light_green), "GMLIB-LRCA")
|
||||||
|
|
||||||
#define LIB_VERSION GMLIB::Version(0, 12, 3)
|
#define LIB_VERSION GMLIB::Version(0, 12, 4)
|
||||||
|
|
||||||
extern ll::Logger logger;
|
extern ll::Logger logger;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"format_version": 2,
|
"format_version": 2,
|
||||||
"tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
|
"tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
|
||||||
"version": "0.12.3",
|
"version": "0.12.4",
|
||||||
"info": {
|
"info": {
|
||||||
"name": "GMLIB-LegacyRemoteCallApi",
|
"name": "GMLIB-LegacyRemoteCallApi",
|
||||||
"description": "Legacy RemoteCall API for GMLIB",
|
"description": "Legacy RemoteCall API for GMLIB",
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
"library"
|
"library"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.12.3/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
|
"asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.12.4/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"github.com/GroupMountain/GMLIB": ">=0.12.4"
|
"github.com/GroupMountain/GMLIB": ">=0.12.4"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user