/// <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="segment"></param> /// <param name="hasTags"></param> /// <param name="tagMapping"></param> /// <returns></returns> public XliffConverter.xliff CreateXliffFile(Segment[] segments) { Log.logger.Trace(""); XliffConverter.xliff xliffDocument = new XliffConverter.xliff( languageDirection.SourceCulture, languageDirection.TargetCulture); foreach (Segment seg in segments) { xliffDocument.AddSourceSegment(seg); } return(xliffDocument); }
public void GetSegments_NoTarget_NullTargetSegments() { Segment[] segments = SegmentParser.Parser.ParseFile( Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TaggedFile.txt")); XliffConverter.xliff xliff = new XliffConverter.xliff( CultureInfo.GetCultureInfo("en-us"), CultureInfo.GetCultureInfo("fr")); foreach (Segment segment in segments) { xliff.AddSourceSegment(segment); } Segment[] targetSegments = xliff.GetTargetSegments(); foreach (Segment segment in targetSegments) { Assert.IsNull(segment); } }
public void AddSourceSegment_NullSourceSegment_ThrowsException() { XliffConverter.xliff xliff = new XliffConverter.xliff( CultureInfo.GetCultureInfo("en-us"), CultureInfo.GetCultureInfo("fr")); xliff.AddSourceSegment(null); }