Browse Source

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 years ago
parent
commit
31c97abab3
1 changed files with 4 additions and 4 deletions
  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";