Преглед на файлове

Create translation dictionary on initialize

Create the dictionary regardless if the translation files could not be
found. Ensures MPS won't crash when trying to get translations.
habeebweeb преди 4 години
родител
ревизия
31c97abab3
променени са 1 файла, в които са добавени 4 реда и са изтрити 4 реда
  1. 4 4
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Translation.cs

+ 4 - 4
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Translation.cs

@@ -38,6 +38,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             string rootTranslationPath = Path.Combine(Constants.configPath, Constants.translationDirectory);
             string currentTranslationPath = Path.Combine(rootTranslationPath, language);
 
+            Translations = new Dictionary<string, Dictionary<string, string>>(
+                StringComparer.InvariantCultureIgnoreCase
+            );
+
             if (!Directory.Exists(currentTranslationPath))
             {
                 Utility.LogWarning(
@@ -46,10 +50,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 return;
             }
 
-            Translations = new Dictionary<string, Dictionary<string, string>>(
-                StringComparer.InvariantCultureIgnoreCase
-            );
-
             foreach (string prop in props)
             {
                 string translationFile = $"translation.{prop}.json";