Package org.omegat.util
Class TMXWriter2
java.lang.Object
org.omegat.util.TMXWriter2
- All Implemented Interfaces:
AutoCloseable
Helper for write TMX files, using StAX.
We can't use JAXB for writing because it changes spaces on formatted output.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTMXWriter2(File file, Language sourceLanguage, Language targetLanguage, boolean sentenceSegmentingEnabled, boolean levelTwo, boolean forceValidTMX) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidwriteComment(String comment) voidwriteEntries(Map<EntryKey, ? extends ITMXEntry> entries, boolean addProp) Write entries.voidwriteEntry(@Nullable String source, @Nullable String translation, @Nullable String note, String creator, long creationDate, @Nullable String changer, long changeDate, @Nullable List<String> propValues) voidwriteEntry(@Nullable String source, @Nullable String translation, ITMXEntry entry, @Nullable List<String> propValues) Write one entry.
-
Field Details
-
PROP_ID
- See Also:
-
-
Constructor Details
-
TMXWriter2
public TMXWriter2(File file, Language sourceLanguage, Language targetLanguage, boolean sentenceSegmentingEnabled, boolean levelTwo, boolean forceValidTMX) throws Exception - Parameters:
file- to write TMX entries.sourceLanguage- language of source.targetLanguage- language of target.sentenceSegmentingEnabled- true when sentence segmenting enabled, otherwise false.levelTwo- When true, the tmx is made compatible with level 2 (TMX version 1.4)- Throws:
Exception- when error occurred.
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
XMLStreamExceptionIOException
-
writeComment
- Throws:
Exception
-
writeEntries
public void writeEntries(Map<EntryKey, ? extends ITMXEntry> entries, boolean addProp) throws ExceptionWrite entries.- Parameters:
entries- Map of SourceTextEntry and TMXEntry to output.- Throws:
Exception- when i/o error or XMLStream error happened.
-
writeEntry
public void writeEntry(@Nullable @Nullable String source, @Nullable @Nullable String translation, ITMXEntry entry, @Nullable @Nullable List<String> propValues) throws Exception Write one entry.- Parameters:
source- source text to write.translation- translation text to write.entry- that has interface ITMXEntry.propValues- pairs with property name and values- Throws:
Exception
-
writeEntry
public void writeEntry(@Nullable @Nullable String source, @Nullable @Nullable String translation, @Nullable @Nullable String note, String creator, long creationDate, @Nullable @Nullable String changer, long changeDate, @Nullable @Nullable List<String> propValues) throws Exception - Throws:
Exception
-