diff --git a/src/DefaultPlugins/Translations/de-DE.json b/src/DefaultPlugins/Translations/de-DE.json index ed21ae1..b2cd352 100644 --- a/src/DefaultPlugins/Translations/de-DE.json +++ b/src/DefaultPlugins/Translations/de-DE.json @@ -1,50 +1,14 @@ -[ - { - "key": "script-displayname", - "value": "Skript ausführung" - }, - { - "key": "script-description", - "value": "Diese Plugin erlaubt Ihnen Skript-Dateien mit dem Modular Tool Manager auszuführen" - }, - { - "key": "binary-displayname", - "value": "Ausführbare Datei starten" - }, - { - "key": "binary-description", - "value": "Diese Plugin erlaubt es Ihnen Binäre Dateien mit dem Modular Tool Manager auszuführen" - }, - { - "key": "batch", - "value": "Batch-Skript" - }, - { - "key": "cmd", - "value": "CMD-Skript" - }, - { - "key": "powershell", - "value": "PowerShell-Skript" - }, - { - "key": "executable", - "value": "Ausführbare-Datei" - }, - { - "key": "error_cant_find_script_file", - "value": "Konnte das auszuführende Skript '{0}' nicht finden" - }, - { - "key": "error_cant_find_binary_file", - "value": "Konnte ausführbare datei '{0}' nicht finden" - }, - { - "key": "hide", - "value": "Terminal verstecken" - }, - { - "key": "adminRequired", - "value": "Als Administrator ausführen" - } -] \ No newline at end of file +{ + "script-displayname": "Skript ausführung", + "script-description": "Diese Plugin erlaubt Ihnen Skript-Dateien mit dem Modular Tool Manager auszuführen", + "binary-displayname": "Ausführbare Datei starten", + "binary-description": "Diese Plugin erlaubt es Ihnen Binäre Dateien mit dem Modular Tool Manager auszuführen", + "batch": "Batch-Skript", + "cmd": "CMD-Skript", + "powershell": "PowerShell-Skript", + "executable": "Ausführbare-Datei", + "error_cant_find_script_file": "Konnte das auszuführende Skript '{0}' nicht finden", + "error_cant_find_binary_file": "Konnte ausführbare datei '{0}' nicht finden", + "hide": "Terminal verstecken", + "adminRequired": "Als Administrator ausführen" +} \ No newline at end of file diff --git a/src/DefaultPlugins/Translations/en-EN.json b/src/DefaultPlugins/Translations/en-EN.json index 373bef0..4564942 100644 --- a/src/DefaultPlugins/Translations/en-EN.json +++ b/src/DefaultPlugins/Translations/en-EN.json @@ -1,50 +1,14 @@ -[ - { - "key": "script-displayname", - "value": "Script execution" - }, - { - "key": "script-description", - "value": "This plugin will allow you to run scrip files with the modular tool manager" - }, - { - "key": "binary-displayname", - "value": "Start executable binary file" - }, - { - "key": "binary-description", - "value": "This plugin will allow you to run binary executable with the modular tool manager" - }, - { - "key": "batch", - "value": "Batch-Script" - }, - { - "key": "cmd", - "value": "CMD-Script" - }, - { - "key": "powershell", - "value": "PowerShell-Script" - }, - { - "key": "executable", - "value": "Executable-File" - }, - { - "key": "error_cant_find_script_file", - "value": "Could not find script '{0}' to execute" - }, - { - "key": "error_cant_find_binary_file", - "value": "Could not find binary file '{0}' to run" - }, - { - "key": "hide", - "value": "Hide command line" - }, - { - "key": "adminRequired", - "value": "Run as Administrator" - } -] \ No newline at end of file +{ + "script-displayname": "Script execution", + "script-description": "This plugin will allow you to run scrip files with the modular tool manager", + "binary-displayname": "Start executable binary file", + "binary-description": "This plugin will allow you to run binary executable with the modular tool manager", + "batch": "Batch-Script", + "cmd": "CMD-Script", + "powershell": "PowerShell-Script", + "executable": "Executable-File", + "error_cant_find_script_file": "Could not find script '{0}' to execute", + "error_cant_find_binary_file": "Could not find binary file '{0}' to run", + "hide": "Hide command line", + "adminRequired": "Run as Administrator" +} \ No newline at end of file diff --git a/src/ModularToolManager/Services/Language/PluginTranslationService.cs b/src/ModularToolManager/Services/Language/PluginTranslationService.cs index 0e3e239..8ce27f6 100644 --- a/src/ModularToolManager/Services/Language/PluginTranslationService.cs +++ b/src/ModularToolManager/Services/Language/PluginTranslationService.cs @@ -167,7 +167,20 @@ private string GetLanguageFromPath(string path) /// A list with all possible translations private List GetTranslationsFromFile(Assembly assembly, string cultureFile) { - return JsonSerializer.Deserialize>(LoadResourceData(assembly, cultureFile)) ?? new(); + List translations = new(); + try + { + var data = JsonSerializer.Deserialize>(LoadResourceData(assembly, cultureFile)); + foreach (var item in data) + { + translations.Add(new TranslationModel { Key = item.Key, Value = item.Value }); + } + } + catch (System.Exception e) + { + logger.LogError(e, "Error trying to parse translation file"); + } + return translations; } ///