Make any new translation files that need to be made.

This commit is contained in:
Tim Young 2017-11-01 15:20:55 -05:00
parent cdda440daf
commit 6f68fdf9c4

View File

@ -21,7 +21,7 @@ namespace EduNetworkBuilder
public partial class TranslationWindow : Form public partial class TranslationWindow : Form
{ {
Network myNet = null; Network myNet = null;
string[,] LanguageChoices = { { NB.Translate("NB_NBEn"), "en" }, { NB.Translate("NB_NBFr"), "fr" } }; string[,] LanguageChoices = NB.LanguageChoices;
string FormChosenDir = ""; string FormChosenDir = "";
List<TranslationResxFile> TranslationResxFiles = new List<TranslationResxFile>(); List<TranslationResxFile> TranslationResxFiles = new List<TranslationResxFile>();
List<TranslationFormData> FormData = new List<TranslationFormData>(); List<TranslationFormData> FormData = new List<TranslationFormData>();
@ -356,6 +356,21 @@ namespace EduNetworkBuilder
TranslationResxFile TRF = new TranslationResxFile(currentFile); TranslationResxFile TRF = new TranslationResxFile(currentFile);
TranslationResxFiles.Add(TRF); TranslationResxFiles.Add(TRF);
} }
//Add any resx files that do not exist, but should
for( int i=0; i< LanguageChoices.Length; i++)
{
TranslationResxFile one = FileFromLangCode(LanguageChoices[i, 1]);
if(one == null)
{
//We need to make an empty resx file
one = new TranslationResxFile();
one.language = LanguageChoices[i, 1];
string filename = "edustrings."+ LanguageChoices[i, 1] + ".resx";
one.filename = filename;
TranslationResxFiles.Add(one);
}
}
//Populate any missing entries.
PopulateFormTranslationItems(); PopulateFormTranslationItems();
} }
@ -435,9 +450,9 @@ namespace EduNetworkBuilder
TranslationResxFile TRf = FileFromLangCode(code); TranslationResxFile TRf = FileFromLangCode(code);
TranslationItem TI = ItemFromKey(TRf, cbFormItemChoice.Text); TranslationItem TI = ItemFromKey(TRf, cbFormItemChoice.Text);
return TI; return TI;
} }
private void btnChooseDir_Click(object sender, EventArgs e) private void btnChooseDir_Click(object sender, EventArgs e)
{ {
string startingDir = FormChosenDir; string startingDir = FormChosenDir;
if (FormChosenDir == "" && File.Exists(myNet.NetworkFilename)) if (FormChosenDir == "" && File.Exists(myNet.NetworkFilename))
@ -525,6 +540,14 @@ namespace EduNetworkBuilder
public string Value = ""; public string Value = "";
public string Comment = ""; public string Comment = "";
public bool translated = false; public bool translated = false;
public TranslationItem() { }
public TranslationItem(TranslationItem Source)
{
Key = Source.Key;
Value = Source.Value;
Comment = Source.Comment;
translated = Source.translated;
}
} }
public class TranslationResxFile public class TranslationResxFile
@ -534,6 +557,8 @@ namespace EduNetworkBuilder
public string language = ""; public string language = "";
string beginning = "translated: "; string beginning = "translated: ";
public TranslationResxFile() { }
public TranslationResxFile(string File) public TranslationResxFile(string File)
{ {
filename = File; filename = File;