Package net.sf.okapi.lib.merge.merge
Class TextUnitMerger
- java.lang.Object
-
- net.sf.okapi.lib.merge.merge.TextUnitMerger
-
- All Implemented Interfaces:
ITextUnitMerger
public class TextUnitMerger extends Object implements ITextUnitMerger
-
-
Constructor Summary
Constructors Constructor Description TextUnitMerger()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcopyCodeMetadata(TextFragment from, TextFragment to)Update the meta fields inCode's "to" that match those of "from" But only if the "to" code has empty data.voidcopyTextPartMetadata(List<TextPart> from, List<TextPart> to, String id)ParametersgetParameters()LocaleIdgetTargetLocale()<T extends TextPart>
booleanhasMeta(T p)ITextUnitmergeTargets(ITextUnit tuFromSkel, ITextUnit tuFromTran)Merges the translated text unit to the one from the skeleton.voidsetCodeMatchStrategy(CodeMatchStrategy strategy)voidsetParameters(Parameters params)voidsetTargetLocale(LocaleId trgLoc)
-
-
-
Method Detail
-
mergeTargets
public ITextUnit mergeTargets(ITextUnit tuFromSkel, ITextUnit tuFromTran)
Description copied from interface:ITextUnitMergerMerges the translated text unit to the one from the skeleton. Merges the text unit's target (under certain conditions).- Specified by:
mergeTargetsin interfaceITextUnitMerger- Parameters:
tuFromSkel- text unit from the skeleton (normally the original file)tuFromTran- text unit from the translation (default merger uses xliff 1.2)- Returns:
- the merged text unit
-
copyTextPartMetadata
public void copyTextPartMetadata(List<TextPart> from, List<TextPart> to, String id)
Description copied from interface:ITextUnitMergerUpdate the meta fields fromTextPart's in "to" that match those of "from"WARNING: Not all TextParts have id's to match on. Fallback is to match on data, but this can be ambiguous in rare cases
- Specified by:
copyTextPartMetadatain interfaceITextUnitMerger- Parameters:
from- list ofTextPartcodes are used to match codes in "to"to- list ofTextPartthat has its code id's updated to match "from"id- parentTextUnitid
-
hasMeta
public <T extends TextPart> boolean hasMeta(T p)
-
copyCodeMetadata
public void copyCodeMetadata(TextFragment from, TextFragment to)
Description copied from interface:ITextUnitMergerUpdate the meta fields inCode's "to" that match those of "from" But only if the "to" code has empty data. Otherwise keep the to code data as-is. Codes match if both data andTextFragment.TagTypeare the same.- Specified by:
copyCodeMetadatain interfaceITextUnitMerger- Parameters:
from-TextFragmentcodes are used to match codes in "to"to-TextFragmentthat has its code id's updated to match "from"
-
setTargetLocale
public void setTargetLocale(LocaleId trgLoc)
- Specified by:
setTargetLocalein interfaceITextUnitMerger
-
getTargetLocale
public LocaleId getTargetLocale()
-
getParameters
public Parameters getParameters()
- Specified by:
getParametersin interfaceITextUnitMerger
-
setParameters
public void setParameters(Parameters params)
- Specified by:
setParametersin interfaceITextUnitMerger
-
setCodeMatchStrategy
public void setCodeMatchStrategy(CodeMatchStrategy strategy)
- Specified by:
setCodeMatchStrategyin interfaceITextUnitMerger
-
-