public void GetSegments_NoTarget_NullTargetSegments() { var segments = Parser.ParseFile( Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TaggedFile.txt")); var file = new File { SourceCulture = CultureInfo.GetCultureInfo("en-us"), TargetCulture = CultureInfo.GetCultureInfo("fr") }; var xliff = new Xliff { File = file }; foreach (var segment in segments) { xliff.AddSourceSegment(segment); } var targetSegments = xliff.GetTargetSegments(); foreach (var segment in targetSegments) { Assert.IsNull(segment); } }
public Xliff CreateXliffFile(Segment[] segments) { var xliffDocument = new Xliff(SourceLanguage, TargetLanguage); foreach (var seg in segments) { if (seg != null) { xliffDocument.AddSourceSegment(seg); } } return(xliffDocument); }
/// <summary> /// Prepares a source translation string for request. It ultimately removes all the tags data, /// storing them temporarily in a dictionary, which then can be used to reinstate the tags' text. /// Function taken from previous ETS Plugin. /// </summary> /// <param name="segments"></param> /// <returns>Xliff</returns> public Xliff CreateXliffFile(Segment[] segments) { Log.Logger.Trace(""); var xliffDocument = new Xliff(languageDirection.SourceCulture, languageDirection.TargetCulture); foreach (var seg in segments) { if (seg != null) { xliffDocument.AddSourceSegment(seg); } } return(xliffDocument); }
public void AddSourceSegment_NullSourceSegment_ThrowsException() { var file = new File { SourceCulture = CultureInfo.GetCultureInfo("en-us"), TargetCulture = CultureInfo.GetCultureInfo("fr") }; var xliff = new Xliff { File = file }; xliff.AddSourceSegment(null); }
/// <summary> /// Prepares a source translation string for request. It ultimately removes all the tags data, /// storing them temporarily in a dictionary, which then can be used to reinstate the tags' text. /// Function taken from previous MTEdge Plugin. /// </summary> /// <param name="segments"></param> /// <returns>Xliff</returns> public Xliff CreateXliffFile(Segment[] segments) { var file = new File { SourceCulture = languageDirection.SourceCulture, TargetCulture = languageDirection.TargetCulture }; var xliffDocument = new Xliff { File = file }; foreach (var seg in segments) { if (seg != null) { xliffDocument.AddSourceSegment(seg); } } return(xliffDocument); }
public void AddSourceSegment_NullSourceSegment_ThrowsException() { var xliff = new Xliff(CultureInfo.GetCultureInfo("en-us"), CultureInfo.GetCultureInfo("fr")); xliff.AddSourceSegment(null); }