From 4d274991081caf9eb140faeef1482573e4f6f7e4 Mon Sep 17 00:00:00 2001 From: KatieFrogs <23621460+KatieFrogs@users.noreply.github.com> Date: Fri, 18 Feb 2022 02:44:37 +0300 Subject: [PATCH] Support plugin name localization --- public/src/js/plugins.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/public/src/js/plugins.js b/public/src/js/plugins.js index 288a6af..30a02d7 100644 --- a/public/src/js/plugins.js +++ b/public/src/js/plugins.js @@ -132,7 +132,7 @@ class Plugins{ var obj = this.allPlugins[i] let plugin = obj.plugin items[obj.name] = { - name: plugin.module.name || obj.name, + name: plugin.module ? this.getLocalTitle(plugin.module.name || obj.name, plugin.module.name_lang) : obj.name, type: "toggle", default: true, getItem: () => plugin.started, @@ -147,6 +147,16 @@ class Plugins{ } return items } + getLocalTitle(title, titleLang){ + if(titleLang){ + for(var id in titleLang){ + if(id === strings.id && titleLang[id]){ + return titleLang[id] + } + } + } + return title + } } class PluginLoader{