diff --git a/lib/GMLIB_API-JS.js b/lib/GMLIB_API-JS.js index d5330a7..dd8bdaf 100644 --- a/lib/GMLIB_API-JS.js +++ b/lib/GMLIB_API-JS.js @@ -19,6 +19,7 @@ const GMLIB_API = { setPlayerNbt: ll.import("GMLIB_API", "setPlayerNbt"), setPlayerNbtTags: ll.import("GMLIB_API", "setPlayerNbtTags"), resourcePackTranslate: ll.import("GMLIB_API", "resourcePackTranslate"), + resourcePackDefaultTranslate: ll.import("GMLIB_API", "resourcePackDefaultTranslate"), getResourcePackI18nLanguage: ll.import("GMLIB_API", "getResourcePackI18nLanguage"), chooseResourcePackI18nLanguage: ll.import("GMLIB_API", "chooseResourcePackI18nLanguage"), setEducationFeatureEnabled: ll.import("GMLib_ServerAPI", "setEducationFeatureEnabled"), @@ -812,8 +813,11 @@ class I18nAPI { throw new Error("Static class cannot be instantiated"); } - static get(key, params = []) { - GMLIB_API.resourcePackTranslate(key, params); + static get(key, params = [], langCode = undefined) { + if (langCode) { + return GMLIB_API.resourcePackTranslate(key, params, langCode); + } + return GMLIB_API.resourcePackDefaultTranslate(key, params); } static translate(key, params = []) { @@ -840,7 +844,7 @@ class I18nAPI { GMLIB_API.updateOrCreateLanguageFile(code, lang, path); } - static loadLanguagePath(path) { + static loadLanguageDirectory(path) { GMLIB_API.loadLanguagePath(path); } }; diff --git a/manifest.json b/manifest.json index 9801910..cd86d46 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "${pluginName}", "entry": "${pluginFile}", - "version": "0.12.3", + "version": "0.12.4", "author": "GroupMountain", "type": "native", "dependencies": [ diff --git a/src/CompatibilityApi.cpp b/src/CompatibilityApi.cpp index ff83f99..6fb677e 100644 --- a/src/CompatibilityApi.cpp +++ b/src/CompatibilityApi.cpp @@ -161,9 +161,16 @@ void Export_Compatibility_API() { }); RemoteCall::exportAs( "GMLIB_API", - "resourcePackTranslate", + "resourcePackDefaultTranslate", [](std::string key, std::vector params) -> std::string { return I18nAPI::get(key, params); } ); + RemoteCall::exportAs( + "GMLIB_API", + "resourcePackTranslate", + [](std::string key, std::vector params, std::string code) -> std::string { + return I18nAPI::get(key, params, code); + } + ); RemoteCall::exportAs("GMLIB_API", "chooseResourcePackI18nLanguage", [](std::string code) -> void { if (GMLIB_Level::getInstance()) { I18nAPI::chooseLanguage(code); diff --git a/src/Global.h b/src/Global.h index aef1ca7..448b261 100644 --- a/src/Global.h +++ b/src/Global.h @@ -5,7 +5,7 @@ #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; diff --git a/tooth.json b/tooth.json index e231c6c..2b2e648 100644 --- a/tooth.json +++ b/tooth.json @@ -1,7 +1,7 @@ { "format_version": 2, "tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi", - "version": "0.12.3", + "version": "0.12.4", "info": { "name": "GMLIB-LegacyRemoteCallApi", "description": "Legacy RemoteCall API for GMLIB", @@ -14,7 +14,7 @@ "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": { "github.com/GroupMountain/GMLIB": ">=0.12.4" },