Class TranslationHandlerImpl

    • Method Detail

      • setTranslatedTexts

        public void setTranslatedTexts​(@NotNull
                                       java.util.List<? extends java.lang.CharSequence> translatedTexts)
        Specified by:
        setTranslatedTexts in interface TranslationHandler
      • transformAnchorRef

        @NotNull
        public java.lang.CharSequence transformAnchorRef​(@NotNull
                                                         java.lang.CharSequence pageRef,
                                                         @NotNull
                                                         java.lang.CharSequence anchorRef)
        Description copied from interface: TranslationContext
        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
        Specified by:
        transformAnchorRef in interface TranslationContext
        Parameters:
        pageRef - url part without the anchor ref to resolve reference
        anchorRef - anchor ref
        Returns:
        anchorRef for the phase to be used for rendering
      • getPlaceholderId

        public java.lang.String getPlaceholderId​(java.lang.String format,
                                                 int placeholderId,
                                                 java.lang.CharSequence prefix,
                                                 java.lang.CharSequence suffix,
                                                 java.lang.CharSequence suffix2)
      • addPrefixSuffix

        public static java.lang.String addPrefixSuffix​(java.lang.CharSequence placeholderId,
                                                       java.lang.CharSequence prefix,
                                                       java.lang.CharSequence suffix,
                                                       java.lang.CharSequence suffix2)
      • postProcessNonTranslating

        public void postProcessNonTranslating​(@NotNull
                                              java.util.function.Function<java.lang.String,​java.lang.CharSequence> postProcessor,
                                              @NotNull
                                              java.lang.Runnable scope)
        Specified by:
        postProcessNonTranslating in interface TranslationContext
        Parameters:
        postProcessor - id post processor for TRANSLATED purpose
        scope - code to which the post processor applies
      • postProcessNonTranslating

        @NotNull
        public <T> T postProcessNonTranslating​(@NotNull
                                               java.util.function.Function<java.lang.String,​java.lang.CharSequence> postProcessor,
                                               @NotNull
                                               java.util.function.Supplier<T> scope)
        Specified by:
        postProcessNonTranslating in interface TranslationContext
        Parameters:
        postProcessor - id post processor for TRANSLATED purpose
        scope - code to which the post processor applies
      • transformNonTranslating

        @NotNull
        public java.lang.CharSequence transformNonTranslating​(java.lang.CharSequence prefix,
                                                              @NotNull
                                                              java.lang.CharSequence nonTranslatingText,
                                                              java.lang.CharSequence suffix,
                                                              java.lang.CharSequence suffix2)
        Description copied from interface: TranslationContext
        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)

        Specified by:
        transformNonTranslating in interface TranslationContext
        Parameters:
        prefix - prefix to use on non-translating placeholder so it is interpreted as a proper element during parsing
        nonTranslatingText - 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 parsing
        suffix2 - suffix to use on non-translating placeholder so it is interpreted as a proper element during parsing
        Returns:
        text to be used in rendering for this phase
      • transformTranslating

        @NotNull
        public java.lang.CharSequence transformTranslating​(java.lang.CharSequence prefix,
                                                           @NotNull
                                                           java.lang.CharSequence translatingText,
                                                           java.lang.CharSequence suffix,
                                                           java.lang.CharSequence suffix2)
        Description copied from interface: TranslationContext
        Transform translating text but which is contextually isolated from the text block in which it is located ie. link reference or image reference

        During RenderPurpose.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)

        Specified by:
        transformTranslating in interface TranslationContext
        Parameters:
        prefix - prefix to use on non-translating placeholder so it is interpreted as a proper element during parsing
        translatingText - 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 parsing
        suffix2 - suffix to use on non-translating placeholder so it is interpreted as a proper element during parsing
        Returns:
        text to be used in rendering for this phase