Преглед изворни кода

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";