This commit is contained in:
@@ -159,7 +159,8 @@ namespace AyaNova.PlugIn.V8
|
|||||||
private Dictionary<Guid, long> Map = new Dictionary<Guid, long>();
|
private Dictionary<Guid, long> Map = new Dictionary<Guid, long>();
|
||||||
private Dictionary<Guid, string> TagMap = new Dictionary<Guid, string>();
|
private Dictionary<Guid, string> TagMap = new Dictionary<Guid, string>();
|
||||||
private Dictionary<string, string> CustomFieldLocaleKeys = new Dictionary<string, string>();//holds custom field Raven as key and v7 custom text for that field for later export
|
private Dictionary<string, string> CustomFieldLocaleKeys = new Dictionary<string, string>();//holds custom field Raven as key and v7 custom text for that field for later export
|
||||||
|
private Dictionary<string, long> LocaleMap = new Dictionary<string, long>();
|
||||||
|
|
||||||
private string ImportTag = "v7-import";
|
private string ImportTag = "v7-import";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -180,6 +181,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
Map.Clear();
|
Map.Clear();
|
||||||
TagMap.Clear();
|
TagMap.Clear();
|
||||||
CustomFieldLocaleKeys.Clear();
|
CustomFieldLocaleKeys.Clear();
|
||||||
|
LocaleMap.Clear();
|
||||||
|
|
||||||
|
|
||||||
//admin user (not exported but is there already)
|
//admin user (not exported but is there already)
|
||||||
@@ -241,11 +243,13 @@ namespace AyaNova.PlugIn.V8
|
|||||||
|
|
||||||
progress.Op("Exporting objects");
|
progress.Op("Exporting objects");
|
||||||
//BIZ objects
|
//BIZ objects
|
||||||
if (progress.KeepGoing)
|
|
||||||
await ExportUsers(progress);
|
|
||||||
if (progress.KeepGoing)
|
if (progress.KeepGoing)
|
||||||
await ExportLocales(progress);
|
await ExportLocales(progress);
|
||||||
|
|
||||||
|
if (progress.KeepGoing)
|
||||||
|
await ExportUsers(progress);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -424,6 +428,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
d = a.ObjectResponse["data"];
|
d = a.ObjectResponse["data"];
|
||||||
d.uiColor = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(c.ScheduleBackColor));
|
d.uiColor = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(c.ScheduleBackColor));
|
||||||
d.emailAddress = string.IsNullOrWhiteSpace(c.EmailAddress) ? null : c.EmailAddress;
|
d.emailAddress = string.IsNullOrWhiteSpace(c.EmailAddress) ? null : c.EmailAddress;
|
||||||
|
d.translationId = LocaleMap[c.DefaultLanguage];
|
||||||
|
|
||||||
await util.PutAsync("UserOptions/" + RavenId.ToString(), d.ToString());
|
await util.PutAsync("UserOptions/" + RavenId.ToString(), d.ToString());
|
||||||
}
|
}
|
||||||
@@ -499,14 +504,37 @@ namespace AyaNova.PlugIn.V8
|
|||||||
//Iterate all RAVEN languages
|
//Iterate all RAVEN languages
|
||||||
for (int x = 1; x < 5; x++)//first four translations are the stock ones
|
for (int x = 1; x < 5; x++)//first four translations are the stock ones
|
||||||
{
|
{
|
||||||
|
//get raven name of locale
|
||||||
|
var RavenLocaleName = RavenLanguageList.Find(m => m.Id == x).Name;
|
||||||
|
//add stock locale mappings in case users are set to a stock one in v7
|
||||||
|
//so can set them later
|
||||||
|
switch (RavenLocaleName)
|
||||||
|
{
|
||||||
|
case "en":
|
||||||
|
LocaleMap.Add("English", x);
|
||||||
|
break;
|
||||||
|
case "fr":
|
||||||
|
LocaleMap.Add("Français", x);
|
||||||
|
break;
|
||||||
|
case "de":
|
||||||
|
LocaleMap.Add("Deutsch", x);
|
||||||
|
break;
|
||||||
|
case "es":
|
||||||
|
LocaleMap.Add("Español", x);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
//MAKE A DUPLICATE
|
//MAKE A DUPLICATE
|
||||||
//name like this: "My custom (Espanol)" etc one for each target stock language
|
//name like this: "My custom (Espanol)" etc one for each target stock language
|
||||||
var exportName = i.Locale + " (" + RavenLanguageList.Find(m => m.Id == x).Name + ")";
|
|
||||||
|
var exportName = i.Locale + " (" + RavenLocaleName + ")";
|
||||||
progress.Op("Exporting " + i.Locale + " to " + exportName);
|
progress.Op("Exporting " + i.Locale + " to " + exportName);
|
||||||
var t = new util.NameIdItem { Name = exportName, Id = x };
|
var t = new util.NameIdItem { Name = exportName, Id = x };
|
||||||
a = await util.PostAsync("Translation/Duplicate", JObject.FromObject(t).ToString());
|
a = await util.PostAsync("Translation/Duplicate", JObject.FromObject(t).ToString());
|
||||||
var targetTranslationId = util.IdFromResponse(a);
|
var targetTranslationId = util.IdFromResponse(a);
|
||||||
var ctoken = util.CTokenFromResponse(a);
|
var ctoken = util.CTokenFromResponse(a);
|
||||||
|
//add to maps so can set user to it on export
|
||||||
|
LocaleMap.Add(i.Locale, targetTranslationId);
|
||||||
//Ok, have our target locale created, not we need to insert our custom translations one by one
|
//Ok, have our target locale created, not we need to insert our custom translations one by one
|
||||||
var trans = ((JArray)a.ObjectResponse["data"]["translationItems"]).ToObject<List<TranslationItem>>();
|
var trans = ((JArray)a.ObjectResponse["data"]["translationItems"]).ToObject<List<TranslationItem>>();
|
||||||
|
|
||||||
@@ -539,7 +567,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
|
|
||||||
|
|
||||||
//update it
|
//update it
|
||||||
progress.SubOp("Posting translation to server ");
|
progress.SubOp("Posting translation "+ exportName +" to server ");
|
||||||
await util.PutAsync("Translation/UpdateTranslationItemsDisplayText",
|
await util.PutAsync("Translation/UpdateTranslationItemsDisplayText",
|
||||||
JArray.FromObject(exportItems).ToString());
|
JArray.FromObject(exportItems).ToString());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user