From d2f3423a5a5830656f31dd7dacfd7124013eccbc Mon Sep 17 00:00:00 2001
From: Tim Young <tim.young@lightsys.org>
Date: Tue, 31 Oct 2017 09:00:05 -0500
Subject: [PATCH] track resx language

---
 EduNetworkBuilder/TranslationWindow.cs | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/EduNetworkBuilder/TranslationWindow.cs b/EduNetworkBuilder/TranslationWindow.cs
index a0bdd96..d8136c7 100644
--- a/EduNetworkBuilder/TranslationWindow.cs
+++ b/EduNetworkBuilder/TranslationWindow.cs
@@ -24,6 +24,8 @@ namespace EduNetworkBuilder
         string[,] LanguageChoices = { { NB.Translate("NB_NBEn"), "en" }, { NB.Translate("NB_NBFr"), "fr" } };
         string FormChosenDir = "";
         List<TranslationResxFile> TranslationResxFiles = new List<TranslationResxFile>();
+        string EnglishTargetFile = "edustrings.resx";
+
 
         public TranslationWindow(Network ToEdit)
         {
@@ -244,7 +246,6 @@ namespace EduNetworkBuilder
         //**********************************************************************//
         bool TryToChooseFormDir(string Choice)
         {
-            string targetfile = "edustrings.resx";
             if (Choice == null || Choice == "") return false;
             //We want to have a file named edustrings.resx there
 
@@ -252,7 +253,7 @@ namespace EduNetworkBuilder
             //If these exist, we are OK.  Otherwise, see if there is a "languages" dir and try that if it does exist
             string toCheck = Path.GetFileName(Choice).ToLower();
             if (File.Exists(Choice))
-                if (toCheck == targetfile)
+                if (toCheck == EnglishTargetFile)
                 {
                     FormChosenDir = Path.GetDirectoryName(Choice);
                     LoadResxFiles();
@@ -266,12 +267,12 @@ namespace EduNetworkBuilder
             if(Directory.Exists(Choice))
             {
                 //It is a directory.  See if it has the correct file in it.
-                if (TryToChooseFormDir(Path.Combine(Choice, targetfile)))
+                if (TryToChooseFormDir(Path.Combine(Choice, EnglishTargetFile)))
                 {
                     return true; //It was successful
                 }
                 //If we get here, it did not have the file.  See if there is a "languages" directory
-                if (TryToChooseFormDir(Path.Combine(Choice, "languages", targetfile))) 
+                if (TryToChooseFormDir(Path.Combine(Choice, "languages", EnglishTargetFile))) 
                 {
                     return true; //It was successful
                 }
@@ -324,11 +325,18 @@ namespace EduNetworkBuilder
     {
         public string filename;
         List<TranslationItem> Items = new List<TranslationItem>();
+        public string language = "";
 
         public TranslationResxFile(string File)
         {
             filename = File;
             Load();
+            if (filename == "edustrings.resx")
+            {
+                language = "en";
+            }
+            else
+                language = filename.Substring(0, 2);
         }
 
         void Load()