This commit is contained in:
@@ -473,7 +473,7 @@ namespace AyaNova.PlugIn.V8
|
||||
var a = await util.GetAsync("Translation/List");
|
||||
JArray ja = (JArray)a.ObjectResponse["data"];
|
||||
var RavenLanguageList = ja.ToObject<List<util.NameIdItem>>();
|
||||
|
||||
|
||||
|
||||
LocaleList l = LocaleList.GetList();
|
||||
foreach (LocaleList.LocaleListInfo i in l)
|
||||
@@ -490,35 +490,48 @@ namespace AyaNova.PlugIn.V8
|
||||
allStrings.Clear();
|
||||
if (StockLocaleHashes.Contains(CurrentLocaleHash)) continue;
|
||||
progress.Op("Locale " + i.Locale + " is customized");
|
||||
|
||||
|
||||
|
||||
//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
|
||||
{
|
||||
//MAKE A DUPLICATE
|
||||
//name like this: "My custom (Espanol)" etc one for each target stock language
|
||||
var exportName = i.Locale + " (" + RavenLanguageList.Find(m => m.Id == x).Name + ")";
|
||||
progress.Op("Exporting " + i.Locale + " to " + exportName);
|
||||
var t = new util.NameIdItem { Name = exportName, Id = x };
|
||||
a = await util.PostAsync("Translation/Duplicate");
|
||||
var targetTranslationId = util.IdFromResponse(a);
|
||||
var ctoken = util.CTokenFromResponse(a);
|
||||
a = await util.PostAsync("Translation/Duplicate");
|
||||
var targetTranslationId = util.IdFromResponse(a);
|
||||
var ctoken = util.CTokenFromResponse(a);
|
||||
//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>>();
|
||||
|
||||
//SET MATCHING KEYS TO OUR TEXT
|
||||
//iterate v7 locale items
|
||||
foreach (var v7item in lt.LT)
|
||||
{
|
||||
var v8key = Translatev7TranslationKey(v7item.Key);
|
||||
TranslationItem v8TransItem = null;
|
||||
foreach (TranslationItem ti in trans)
|
||||
{
|
||||
if (ti.Key == v8key)
|
||||
{
|
||||
v8TransItem = ti;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (v8TransItem == null) { throw new ArgumentOutOfRangeException("On exporting custom locale " + i.Locale + " source key " + v7item.Key + ", destination key " + v8key + " was not found."); }
|
||||
|
||||
v8TransItem.Display = v7item.Value;
|
||||
JObject d = JObject.FromObject(v8TransItem);
|
||||
progress.SubOp("Posting key: " + v7item.Key);
|
||||
//update it
|
||||
await util.PostAsync("Translation/UpdateTranslationItemDisplayText", d.ToString());
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
//duplicate then replace
|
||||
|
||||
|
||||
|
||||
//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());
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
progress.Op("");
|
||||
@@ -527,6 +540,15 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
|
||||
#region locale utility
|
||||
public class TranslationItem
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public uint ConcurrencyToken { get; set; }
|
||||
public string Key { get; set; }
|
||||
public string Display { get; set; }
|
||||
public long TranslationId { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Used by import, translate the old v7 translation key name into the new shorter version
|
||||
@@ -922,7 +944,7 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
}
|
||||
#endregion attachments
|
||||
|
||||
|
||||
#region WIKI page exporter
|
||||
|
||||
|
||||
@@ -1443,7 +1465,7 @@ and this one
|
||||
#endregion sample
|
||||
|
||||
#endregion wiki
|
||||
|
||||
|
||||
#region TAGS
|
||||
private void Tagit(Guid g, List<string> tags)
|
||||
{
|
||||
@@ -1467,7 +1489,7 @@ and this one
|
||||
#endregion tags
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#region OLD JSON EXPORT STUFF
|
||||
#region Global settings
|
||||
|
||||
Reference in New Issue
Block a user