Class ODTDocumentTextTranslator


  • public class ODTDocumentTextTranslator
    extends Object
    It is a translator of text containing in some parts of an ODT documents. It is instanciated for a given localized resource bundle from which it will fetch the translated text. Currently it translates all the header, footer, paragraphs and tables in an ODT document. Instances of this class are mainly used to translate predefined text in templates in the ODT format. The text to translate is refered in the document as a key in the backed resource bundle. If the key exists, it is replaced in the ODT document by its associated translation.
    • Method Detail

      • aTranslatorWith

        public static ODTDocumentTextTranslator aTranslatorWith​(org.silverpeas.core.util.LocalizationBundle bundle)
        Creates a translator of ODT texts with the specified localized resource bundle.
        Parameters:
        bundle - the bundle to use for translating texts.
        Returns:
        an ODTDocumentTextTranslator instance.
      • translate

        public void translate​(org.odftoolkit.simple.TextDocument document)
        Translates the specified ODT document. Each text to translate in the document should be actually a key in the resource bundle to the translated text to use; the key in the document is then replaced by the associated translated text. If the text is not a key in the resource bundle, then it isn't translated and it is kept as such in the document.
        Parameters:
        document - the document to translate.