private IContextProperties CreateContext(string spec, string unitID) { try { var contextProperties = PropertiesFactory.CreateContextProperties(); var contextInfo = PropertiesFactory.CreateContextInfo(StandardContextTypes.Paragraph); contextInfo.Purpose = ContextPurpose.Information; // add unit id as metadata var contextId = PropertiesFactory.CreateContextInfo("UnitId"); contextId.SetMetaData("UnitID", unitID); contextId.Description = "Original paragraph unit id"; contextId.DisplayCode = "ID"; contextProperties.Contexts.Add(contextInfo); contextProperties.Contexts.Add(contextId); return(contextProperties); } catch (Exception ex) { Log.Logger.Error($"CreateContext method: {ex.Message}\n {ex.StackTrace}"); } return(null); }
// output context information, not required, but useful // information for the translator private void WriteContext(string ContextContent) { IContextProperties contextProperties = PropertiesFactory.CreateContextProperties(); IContextInfo contextInfo = PropertiesFactory.CreateContextInfo(ContextContent); contextInfo.DisplayCode = "EL"; contextInfo.DisplayName = "Element"; contextInfo.Description = ContextContent; contextInfo.DisplayColor = Color.Beige; contextProperties.Contexts.Add(contextInfo); Output.ChangeContext(contextProperties); }
public IContextInfo CreateContextInfo(Context context) { var contextInfo = PropertiesFactory.CreateContextInfo(context.ContextType); contextInfo.DisplayName = context.DisplayName; contextInfo.DisplayCode = context.DisplayCode; contextInfo.Description = context.Description; foreach (var metaData in context.MetaData) { contextInfo.SetMetaData(metaData.Key, metaData.Value); } return(contextInfo); }
private IContextProperties CreateContext(string unitId) { IContextProperties contextProperties = PropertiesFactory.CreateContextProperties(); IContextInfo contextInfo = PropertiesFactory.CreateContextInfo(StandardContextTypes.Paragraph); contextInfo.Purpose = ContextPurpose.Information; // add unit id as metadata IContextInfo contextId = PropertiesFactory.CreateContextInfo("UnitId"); contextId.SetMetaData("UnitID", unitId); contextId.Description = "Original paragraph unit id"; contextId.DisplayCode = "ID"; contextProperties.Contexts.Add(contextInfo); contextProperties.Contexts.Add(contextId); return(contextProperties); }
private IContextProperties CreateContext(string id, string paraId) { IContextProperties contextProperties = PropertiesFactory.CreateContextProperties(); IContextInfo contextId = PropertiesFactory.CreateContextInfo("id"); contextId.SetMetaData("ID", id); contextId.Description = "Trans-unit id"; contextId.DisplayCode = "ID"; IContextInfo contextParaId = PropertiesFactory.CreateContextInfo("para-id"); contextParaId.SetMetaData("PARA ID", paraId); contextParaId.Description = "Para-id"; contextParaId.DisplayCode = "PARA ID"; contextProperties.Contexts.Add(contextId); contextProperties.Contexts.Add(contextParaId); return(contextProperties); }
private IContextProperties CreateContext(string spec, string unitID) { // context info for type information, e.g. heading, paragraph, etc. IContextProperties contextProperties = PropertiesFactory.CreateContextProperties(); IContextInfo contextInfo = PropertiesFactory.CreateContextInfo(StandardContextTypes.Paragraph); contextInfo.Purpose = ContextPurpose.Information; // add unit id as metadata IContextInfo contextId = PropertiesFactory.CreateContextInfo("UnitId"); contextId.SetMetaData("UnitID", unitID); switch (spec) { case "Heading": contextInfo = PropertiesFactory.CreateContextInfo(StandardContextTypes.Topic); contextInfo.DisplayColor = Color.Green; break; case "Box": contextInfo = PropertiesFactory.CreateContextInfo(StandardContextTypes.TextBox); contextInfo.DisplayColor = Color.Gold; break; case "Paragraph": contextInfo = PropertiesFactory.CreateContextInfo(StandardContextTypes.Paragraph); contextInfo.DisplayColor = Color.Silver; break; default: break; } contextProperties.Contexts.Add(contextInfo); contextProperties.Contexts.Add(contextId); return(contextProperties); }