Translation window synchs fields if no field had been set.

This commit is contained in:
Tim Young 2017-11-01 15:58:38 -05:00
parent 6f68fdf9c4
commit 4169aeb35e
3 changed files with 2250 additions and 2199 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -357,7 +357,7 @@ namespace EduNetworkBuilder
TranslationResxFiles.Add(TRF);
}
//Add any resx files that do not exist, but should
for( int i=0; i< LanguageChoices.Length; i++)
for( int i=0; i< LanguageChoices.GetLength(0); i++)
{
TranslationResxFile one = FileFromLangCode(LanguageChoices[i, 1]);
if(one == null)
@ -371,6 +371,28 @@ namespace EduNetworkBuilder
}
}
//Populate any missing entries.
TranslationResxFile EN = FileFromLangCode("en");
if(EN != null) //Being null had better not happen... But just in case.
{
TranslationItem tempTI = null;
foreach(TranslationResxFile TRF in TranslationResxFiles)
{
if (TRF.language == EN.language) continue; //skip eng since that is the master
//Make sure each language has each item that the Eng version has
foreach(TranslationItem TI in EN.Items)
{
tempTI = ItemFromKey(TRF, TI.Key);
if(tempTI == null) //It does not exist in this language. Add it
{
tempTI = new TranslationItem(TI);
tempTI.translated = false; //Make sure it is set to false.
TRF.Items.Add(tempTI);
ChangedFormData = true; //We have changed something. We want to be able to save it
}
}
}
}
//Populate the fields from our new data
PopulateFormTranslationItems();
}
@ -622,6 +644,7 @@ namespace EduNetworkBuilder
WriteResx.Close();
//If we have an error, we should have exited and gone to "catch."
//Proceed to put the new file
if(File.Exists(filename))
File.Delete(filename);
File.Move(tmpfile, filename);
}