track resx language

This commit is contained in:
Tim Young 2017-10-31 09:00:05 -05:00
parent 737ee16718
commit d2f3423a5a
1 changed files with 12 additions and 4 deletions

View File

@ -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()