This commit is contained in:
@@ -203,7 +203,9 @@ namespace AyaNova.PlugIn.V8
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
if (progress.KeepGoing)
|
||||||
|
await ExportLocales(progress);
|
||||||
|
return;
|
||||||
|
|
||||||
//Export in correct order:
|
//Export in correct order:
|
||||||
|
|
||||||
@@ -240,8 +242,8 @@ namespace AyaNova.PlugIn.V8
|
|||||||
//BIZ objects
|
//BIZ objects
|
||||||
if (progress.KeepGoing)
|
if (progress.KeepGoing)
|
||||||
await ExportUsers(progress);
|
await ExportUsers(progress);
|
||||||
if (progress.KeepGoing)
|
//if (progress.KeepGoing)
|
||||||
await ExportLocales(progress);
|
// await ExportLocales(progress);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -456,53 +458,78 @@ namespace AyaNova.PlugIn.V8
|
|||||||
#region locales
|
#region locales
|
||||||
private async System.Threading.Tasks.Task ExportLocales(ProgressForm progress)
|
private async System.Threading.Tasks.Task ExportLocales(ProgressForm progress)
|
||||||
{
|
{
|
||||||
|
progress.Append("Exporting customized Locales");
|
||||||
//checksum locales
|
//checksum locales
|
||||||
//if a recognized checksum then don't import because it means it wasn't modified from stock
|
//if a recognized checksum then don't import because it means it wasn't modified from stock
|
||||||
|
/*
|
||||||
|
Stock fresh trial db (fb) values:
|
||||||
|
Locale: Custom English hash code: 740187325
|
||||||
|
Locale: Deutsch hash code: -257973661
|
||||||
|
Locale: English hash code: 740187325
|
||||||
|
Locale: Español hash code: -373723947
|
||||||
|
Locale: Français hash code: -224208815
|
||||||
|
*/
|
||||||
|
List<int> StockLocaleHashes = new List<int>();
|
||||||
|
StockLocaleHashes.Add(-257973661);
|
||||||
|
StockLocaleHashes.Add(740187325);
|
||||||
|
StockLocaleHashes.Add(-373723947);
|
||||||
|
StockLocaleHashes.Add(-224208815);
|
||||||
|
|
||||||
|
LocaleList l = LocaleList.GetList();
|
||||||
LocaleList l = LocaleList.GetList();
|
|
||||||
progress.Append("Exporting " + l.Count.ToString() + " Locales");
|
|
||||||
foreach (LocaleList.LocaleListInfo i in l)
|
foreach (LocaleList.LocaleListInfo i in l)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (!progress.KeepGoing) return;
|
if (!progress.KeepGoing) return;
|
||||||
if (i.Locale != "English")
|
|
||||||
{
|
|
||||||
LocalizedTextTable lt = LocalizedTextTable.Load(i.Locale);
|
|
||||||
List<string> allStrings = new List<string>();
|
|
||||||
foreach (var entry in lt.LT) {
|
|
||||||
allStrings.Add(entry.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
progress.Append("Locale: " + i.Locale + " hash code: " + util.GetOrderIndependentHashCode<string>(allStrings));
|
|
||||||
|
|
||||||
//todo: all locales except English default need to be dealt with
|
LocalizedTextTable lt = LocalizedTextTable.Load(i.Locale);
|
||||||
//above skiplocales is incorrect
|
progress.Op("Checking if locale " + i.Locale + " is customized");
|
||||||
|
//calculate hash
|
||||||
//todo: do the language ones by fetching the equivalent language and then bring over from here (if modified)
|
List<string> allStrings = new List<string>();
|
||||||
//maybe there's a way to tell if the stock locales have been edited and skip them if not? Modified date?
|
foreach (var entry in lt.LT)
|
||||||
//no, need to checksum them I think
|
allStrings.Add(entry.Value);
|
||||||
|
int CurrentLocaleHash = util.GetOrderIndependentHashCode<string>(allStrings);
|
||||||
|
allStrings.Clear();
|
||||||
|
if (StockLocaleHashes.Contains(CurrentLocaleHash)) continue;
|
||||||
|
progress.Op("Locale " + i.Locale + " is customized, exporting");
|
||||||
|
// progress.Append("Locale: " + i.Locale + " hash code: " + CurrentLocaleHash.ToString());
|
||||||
|
|
||||||
//todo: determine what users are set to for locales and only import those ones!!!
|
/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//todo: somehow identify where a custom list not of our own comes from originally so can start with that list
|
Dev db values:
|
||||||
//i.e. someone may have started with spanish then customized some of it so we need to also start with spanish and customize
|
Locale: Custom English hash code: -673510828
|
||||||
//likely if can matchup some parts of it then we would know or at least guess.
|
Locale: Deutsch hash code: -257973661
|
||||||
//Not sure what but maybe something they can't modify, like an internal error or something?
|
Locale: English hash code: 740187325
|
||||||
|
Locale: Español hash code: -373723947
|
||||||
|
Locale: Français hash code: -224208815
|
||||||
|
|
||||||
//need a key translator so can give old and get new then just update it's value
|
*/
|
||||||
|
|
||||||
|
//todo: all locales except English default need to be dealt with
|
||||||
|
//above skiplocales is incorrect
|
||||||
|
|
||||||
|
//todo: do the language ones by fetching the equivalent language and then bring over from here (if modified)
|
||||||
|
//maybe there's a way to tell if the stock locales have been edited and skip them if not? Modified date?
|
||||||
|
//no, need to checksum them I think
|
||||||
|
|
||||||
|
//todo: determine what users are set to for locales and only import those ones!!!
|
||||||
|
|
||||||
|
|
||||||
|
//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
|
||||||
|
|
||||||
|
//dynamic d = new JObject();
|
||||||
|
//d.id = 1;
|
||||||
|
//d.name = i.Locale;
|
||||||
|
//var a = util.PostAsync("Translation/Duplicate", d.ToString());
|
||||||
|
|
||||||
//dynamic d = new JObject();
|
|
||||||
//d.id = 1;
|
|
||||||
//d.name = i.Locale;
|
|
||||||
//var a = util.PostAsync("Translation/Duplicate", d.ToString());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion locales
|
#endregion locales
|
||||||
|
|||||||
Reference in New Issue
Block a user