public class TranslationHandlerImpl extends Object implements TranslationHandler
| Constructor and Description |
|---|
TranslationHandlerImpl(com.vladsch.flexmark.util.options.DataHolder options,
FormatterOptions formatterOptions,
com.vladsch.flexmark.html.renderer.HtmlIdGeneratorFactory idGeneratorFactory) |
| Modifier and Type | Method and Description |
|---|---|
static String |
addPrefixSuffix(CharSequence placeholderId,
CharSequence prefix,
CharSequence suffix,
CharSequence suffix2) |
void |
beginRendering(com.vladsch.flexmark.ast.Document node,
NodeFormatterContext context,
MarkdownWriter appendable) |
void |
customPlaceholderFormat(TranslationPlaceholderGenerator generator,
TranslatingSpanRender render)
Temporarily change the format for placeholders
|
String |
getPlaceholderId(String format,
int placeholderId,
CharSequence prefix,
CharSequence suffix,
CharSequence suffix2) |
RenderPurpose |
getRenderPurpose()
Get the reason this format rendering is being performed
|
List<String> |
getTranslatingTexts() |
com.vladsch.flexmark.util.options.MutableDataSet |
getTranslationStore()
Get MutableDataHolder for storing this translation run values across render purpose phases
|
boolean |
isTransformingText()
Returns false if special translation functions are no-ops
During
RenderPurpose.TRANSLATION_SPANS this is true
During RenderPurpose.TRANSLATED_SPANS this is true
During RenderPurpose.TRANSLATED this is true |
void |
nonTranslatingSpan(TranslatingSpanRender render)
Separate non-translation span.
|
void |
setRenderPurpose(RenderPurpose renderPurpose) |
void |
setTranslatedTexts(List<CharSequence> translatedTexts) |
CharSequence |
transformAnchorRef(CharSequence pageRef,
CharSequence anchorRef)
During
RenderPurpose.TRANSLATION_SPANS this converts anchorRef to ordinal placeholder id
During RenderPurpose.TRANSLATED_SPANS this returns the ordinal placeholder
During RenderPurpose.TRANSLATED this returns new anchorRef for the AnchorRefTarget original was referring to |
CharSequence |
transformNonTranslating(CharSequence prefix,
CharSequence nonTranslatingText,
CharSequence suffix,
CharSequence suffix2)
Transform non-translating text
During
RenderPurpose.TRANSLATION_SPANS this converts text to non-translating placeholder based on ordinal id
During RenderPurpose.TRANSLATED_SPANS this returns the non-translating placeholder based on ordinal id
During RenderPurpose.TRANSLATED this returns the original non-translating text for the nonTranslatingText (placeholder) |
CharSequence |
transformTranslating(CharSequence prefix,
CharSequence translatingText,
CharSequence suffix,
CharSequence suffix2)
Transform translating text but which is contextually isolated from the text block in which it is located ie.
|
void |
translatingRefTargetSpan(com.vladsch.flexmark.ast.Node target,
TranslatingSpanRender render)
Separate translation span which is also a ref target
|
void |
translatingSpan(TranslatingSpanRender render)
Separate translation span.
|
public TranslationHandlerImpl(com.vladsch.flexmark.util.options.DataHolder options,
FormatterOptions formatterOptions,
com.vladsch.flexmark.html.renderer.HtmlIdGeneratorFactory idGeneratorFactory)
public com.vladsch.flexmark.util.options.MutableDataSet getTranslationStore()
TranslationContextgetTranslationStore in interface TranslationContextpublic void beginRendering(com.vladsch.flexmark.ast.Document node,
NodeFormatterContext context,
MarkdownWriter appendable)
beginRendering in interface TranslationHandlerpublic List<String> getTranslatingTexts()
getTranslatingTexts in interface TranslationHandlerpublic void setTranslatedTexts(List<CharSequence> translatedTexts)
setTranslatedTexts in interface TranslationHandlerpublic void setRenderPurpose(RenderPurpose renderPurpose)
setRenderPurpose in interface TranslationHandlerpublic RenderPurpose getRenderPurpose()
TranslationContextgetRenderPurpose in interface TranslationContextpublic boolean isTransformingText()
TranslationContextRenderPurpose.TRANSLATION_SPANS this is true
During RenderPurpose.TRANSLATED_SPANS this is true
During RenderPurpose.TRANSLATED this is trueisTransformingText in interface TranslationContextpublic CharSequence transformAnchorRef(CharSequence pageRef, CharSequence anchorRef)
TranslationContextRenderPurpose.TRANSLATION_SPANS this converts anchorRef to ordinal placeholder id
During RenderPurpose.TRANSLATED_SPANS this returns the ordinal placeholder
During RenderPurpose.TRANSLATED this returns new anchorRef for the AnchorRefTarget original was referring totransformAnchorRef in interface TranslationContextpageRef - url part without the anchor ref to resolve referenceanchorRef - anchor refpublic void customPlaceholderFormat(TranslationPlaceholderGenerator generator, TranslatingSpanRender render)
TranslationContextcustomPlaceholderFormat in interface TranslationContextgenerator - placeholder generatorrender - render which will be used with the custom generatorpublic void translatingSpan(TranslatingSpanRender render)
TranslationContextRenderPurpose.TRANSLATION_SPANS this adds the generated output to translation spans
During RenderPurpose.TRANSLATED_SPANS output from renderer is suppressed, instead outputs corresponding translated span
During RenderPurpose.TRANSLATED calls rendertranslatingSpan in interface TranslationContextpublic void translatingRefTargetSpan(com.vladsch.flexmark.ast.Node target,
TranslatingSpanRender render)
TranslationContexttranslatingRefTargetSpan in interface TranslationContextpublic void nonTranslatingSpan(TranslatingSpanRender render)
TranslationContextRenderPurpose.TRANSLATION_SPANS this adds the generated output to translation spans
During RenderPurpose.TRANSLATED_SPANS output from renderer is suppressed, instead outputs corresponding translated span
During RenderPurpose.TRANSLATED calls rendernonTranslatingSpan in interface TranslationContextpublic String getPlaceholderId(String format, int placeholderId, CharSequence prefix, CharSequence suffix, CharSequence suffix2)
public static String addPrefixSuffix(CharSequence placeholderId, CharSequence prefix, CharSequence suffix, CharSequence suffix2)
public CharSequence transformNonTranslating(CharSequence prefix, CharSequence nonTranslatingText, CharSequence suffix, CharSequence suffix2)
TranslationContextRenderPurpose.TRANSLATION_SPANS this converts text to non-translating placeholder based on ordinal id
During RenderPurpose.TRANSLATED_SPANS this returns the non-translating placeholder based on ordinal id
During RenderPurpose.TRANSLATED this returns the original non-translating text for the nonTranslatingText (placeholder)transformNonTranslating in interface TranslationContextprefix - prefix to use on non-translating placeholder so it is interpreted as a proper element during parsingnonTranslatingText - non-rendering text of the node (content will depend on translation phase)suffix - suffix to use on non-translating placeholder so it is interpreted as a proper element during parsingsuffix2 - suffix to use on non-translating placeholder so it is interpreted as a proper element during parsingpublic CharSequence transformTranslating(CharSequence prefix, CharSequence translatingText, CharSequence suffix, CharSequence suffix2)
TranslationContextRenderPurpose.TRANSLATION_SPANS this converts text to non-translating placeholder based on ordinal id and adds it to translation snippets
During RenderPurpose.TRANSLATED_SPANS this returns the non-translating placeholder based on ordinal id
During RenderPurpose.TRANSLATED this returns the translated text for the translatingText (placeholder)transformTranslating in interface TranslationContextprefix - prefix to use on non-translating placeholder so it is interpreted as a proper element during parsingtranslatingText - translating but isolated text of the node (content will depend on translation phase)suffix - suffix to use on non-translating placeholder so it is interpreted as a proper element during parsingsuffix2 - suffix to use on non-translating placeholder so it is interpreted as a proper element during parsingCopyright © 2018. All rights reserved.