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
{
Network myNet = null;
string[,] LanguageChoices = { { NB.Translate("NB_NBEn"), "en" }, { NB.Translate("NB_NBFr"), "fr" } };
string[,] LanguageChoices = NB.LanguageChoices;
string FormChosenDir = "";
List<TranslationResxFile> TranslationResxFiles = new List<TranslationResxFile>();
List<TranslationFormData> FormData = new List<TranslationFormData>();
@ -356,6 +356,21 @@ namespace EduNetworkBuilder
TranslationResxFile TRF = new TranslationResxFile(currentFile);
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();
}
@ -435,9 +450,9 @@ namespace EduNetworkBuilder
TranslationResxFile TRf = FileFromLangCode(code);
TranslationItem TI = ItemFromKey(TRf, cbFormItemChoice.Text);
return TI;
}
}
private void btnChooseDir_Click(object sender, EventArgs e)
private void btnChooseDir_Click(object sender, EventArgs e)
{
string startingDir = FormChosenDir;
if (FormChosenDir == "" && File.Exists(myNet.NetworkFilename))
@ -525,6 +540,14 @@ namespace EduNetworkBuilder
public string Value = "";
public string Comment = "";
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
@ -534,6 +557,8 @@ namespace EduNetworkBuilder
public string language = "";
string beginning = "translated: ";
public TranslationResxFile() { }
public TranslationResxFile(string File)
{
filename = File;