diff --git a/source/Plugins/AyaNova.Plugin.V8/V8.cs b/source/Plugins/AyaNova.Plugin.V8/V8.cs index 28df3d7..626eb6c 100644 --- a/source/Plugins/AyaNova.Plugin.V8/V8.cs +++ b/source/Plugins/AyaNova.Plugin.V8/V8.cs @@ -160,7 +160,7 @@ namespace AyaNova.PlugIn.V8 private Dictionary TagMap = new Dictionary(); private Dictionary CustomFieldLocaleKeys = new Dictionary();//holds custom field Raven as key and v7 custom text for that field for later export private string ImportTag = "v7-import"; - + /// /// Dump the objects into a temporary directory as a series of JSON files /// then zip it all up into a single archive file and then erase the temporary folder @@ -179,7 +179,7 @@ namespace AyaNova.PlugIn.V8 Map.Clear(); TagMap.Clear(); CustomFieldLocaleKeys.Clear(); - + //admin user (not exported but is there already) Map.Add(User.AdministratorID, 1); @@ -312,7 +312,7 @@ namespace AyaNova.PlugIn.V8 #region Export administrator wiki and attached files if present { User admin = User.GetItem(User.AdministratorID); - progress.Op("Administrator account"); + progress.Op("Administrator account"); //Attachments and wiki string AdminWikiContent = null; var hasWiki = WikiPage.HasWiki(User.AdministratorID); @@ -357,7 +357,7 @@ namespace AyaNova.PlugIn.V8 if (i.ID == User.AdministratorID) continue; User c = User.GetItem(i.ID); - + dynamic d = new JObject(); d.name = c.FirstName + " " + c.LastName; progress.Op("User " + d.name); @@ -469,7 +469,7 @@ namespace AyaNova.PlugIn.V8 StockLocaleHashes.Add(-373723947); StockLocaleHashes.Add(-224208815); - LocaleList l = LocaleList.GetList(); + LocaleList l = LocaleList.GetList(); foreach (LocaleList.LocaleListInfo i in l) { if (!progress.KeepGoing) return; @@ -491,16 +491,43 @@ namespace AyaNova.PlugIn.V8 int nGermanSimilar = 0; LocalizedTextTable ltTemp = LocalizedTextTable.Load("English"); - var diff = lt.LT.Where(entry => ltTemp.LT[entry.Key] != entry.Value) - .ToDictionary(entry => entry.Key, entry => entry.Value); - - + nEnglishSimilar = lt.LT.Where(entry => ltTemp.LT[entry.Key] != entry.Value) + .ToDictionary(entry => entry.Key, entry => entry.Value).Count; + + ltTemp = LocalizedTextTable.Load("Français"); + nFrenchSimilar = lt.LT.Where(entry => ltTemp.LT[entry.Key] != entry.Value) + .ToDictionary(entry => entry.Key, entry => entry.Value).Count; + + ltTemp = LocalizedTextTable.Load("Español"); + nSpanishSimilar = lt.LT.Where(entry => ltTemp.LT[entry.Key] != entry.Value) + .ToDictionary(entry => entry.Key, entry => entry.Value).Count; + + ltTemp = LocalizedTextTable.Load("Deutsch"); + nGermanSimilar = lt.LT.Where(entry => ltTemp.LT[entry.Key] != entry.Value) + .ToDictionary(entry => entry.Key, entry => entry.Value).Count; + + string closestSource = "English"; + int closestCount = nEnglishSimilar; + if (nFrenchSimilar > closestCount) + { + closestSource = "Français"; + closestCount = nFrenchSimilar; + } + if (nSpanishSimilar > closestCount) + { + closestSource = "Español"; + closestCount = nSpanishSimilar; + } + if (nGermanSimilar > closestCount) + { + closestSource = "Deutsch"; + closestCount = nGermanSimilar; + } + progress.SubOp("Closest match to base export is " + closestSource); + + //Duplicate closest match RAVEN translation, then update each value that differs from stock - //todo: somehow identify where a custom list not of our own comes from originally so can start with that list - //i.e. someone may have started with spanish then customized some of it so we need to also start with spanish and customize - //likely if can matchup some parts of it then we would know or at least guess. - //Not sure what but maybe something they can't modify, like an internal error or something? //need a key translator so can give old and get new then just update it's value