Package org.silverpeas.components.kmelia.export

## Class ODTDocumentTextTranslator

- java.lang.Object
- - org.silverpeas.components.kmelia.export.ODTDocumentTextTranslator

-     public class ODTDocumentTextTranslator
      extends Object

  It is a translator of text containing in some parts of an ODT documents. It is instantiated 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 referred 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 Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static ODTDocumentTextTranslator` | `aTranslatorWith​(org.silverpeas.kernel.bundle.LocalizationBundle bundle)` | Creates a translator of ODT texts with the specified localized resource bundle.
    `void` | `translate​(org.odftoolkit.simple.TextDocument document)` | Translates the specified ODT document.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### aTranslatorWith

          public static ODTDocumentTextTranslator aTranslatorWith​(org.silverpeas.kernel.bundle.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.