Oracle XML Publisher Report Language Translation

Introduction:

XML Publisher is a reporting solution offered by Oracle. This technology offers integration between Data logic, Layout and Translation. Pre-era of Oracle XML Publisher or known as Oracle BI Publisher, this advantage was not possible in convenient reporting strategy. Below diagram suggest the difference between the two reporting system and the advantage of XML Publisher.

Early Architecture:

 

Oracle XML Publisher Architecture:

 

If you notice the difference, Oracle XML publisher is much more flexible than its predecessors. Oracle XML Publisher is decentralized with the Data, Layout and Translation part. Hence it is much more easier to add/edit either of them. For an example, if you have an existing XML Publisher report which is in English only and you want to add another translation for French language, you can only touch the translation part s you don't have to touch the data and layout part. Which was not possible earlier days with Oracle Reports.

Options:

Option 1: Generate an XLIFF file from the original template (at run time the original template is applied for the layout and the XLIFF file is applied for the translation). After putting the values for parameters for the concurrent program, Click the ‘Options…’ button to select the template language. If you only require translation of the text strings of the template layout, use this method.

Option 2: This option suggests language translation using MLS function. Use this option when you require providing a language parameter in the concurrent program itself. Please note that this method will submit two concurrent programs. One is the parent program and the other one is child. The parent program will call the MLS function to determine the template language for the child program. The child concurrent program is submitted with the template language determined by the MLS function. Actual report output is found in the child program.

To know more about MLS function, read our article on MLS function.

Option 3: We do not suggest this option for implementation but it is still an option in Oracle. Create a separate RTF template that is translated (a localized template). Select the template while submitting the concurrent program from the SRS submission screen. After putting the values for parameters for the concurrent program, Click the ‘Options…’ button to select the template. This method is useful when the translated template requires a different layout from the original template. The drawback of this approach is for each language you will have one .rtf template which is not suggested for maintenance.

So we will only discuss about the Option 1 here as Option 2 is discussed in the another blog and Option 3 is not in context here.

 

How XLIFF file works?

XLIFF (XML Localisation Interchange File Format) files are used to store the translation into target language.

Step 1: Define the concurrent program, data definition and data temple (Not going into details of how to define them). Now when you define the template make sure you check the option "Translatable".

Step 2: Once the template is created, you should download the translation file (.xlf) file to your local machine by clicking the ‘Export Translation’ button.

Step 3: The translation file (.xlf) will look like below:

<?xml version = '1.0' encoding = 'utf-8'?>
<xliff version="1.0">
   <file source-language="en" target-language="en" datatype="XDO" original="orphan.xlf" product-version="orphan.xlf" product-name="">
      <header>
         <prop-group name="ora_reconstruction">
            <prop prop-type="TemplateCode">XX_TEST_DEMO_TEMPLATE</prop>
            <prop prop-type="extractorVersion">10.1.3.4.2_1.5</prop>
         </prop-group>
      </header>
      <body>
         <trans-unit id="b475acba" maxbytes="4000" maxwidth="26" size-unit="char" translate="yes">
            <source>Organization Code</source>
            <target>Organization Code</target>
            <note>Text located: body/table</note>
         </trans-unit>
         <trans-unit id="b47a7958" maxbytes="4000" maxwidth="26" size-unit="char" translate="yes">
            <source>Organization Name</source>
            <target>Organization Name</target>
            <note>Text located: body/table</note>
         </trans-unit>
      </body>
   </file>
</xliff>

Step 4: Now modify the file as below. Note the target-language and target tag is changed.

<?xml version = '1.0' encoding = 'utf-8'?>
<xliff version="1.0">
   <file source-language="en" target-language="fr" datatype="XDO" original="orphan.xlf" product-version="orphan.xlf" product-name="">
      <header>
         <prop-group name="ora_reconstruction">
            <prop prop-type="TemplateCode">XX_TEST_DEMO_TEMPLATE</prop>
            <prop prop-type="extractorVersion">10.1.3.4.2_1.5</prop>
         </prop-group>
      </header>
      <body>
         <trans-unit id="b475acba" maxbytes="4000" maxwidth="26" size-unit="char" translate="yes">
            <source>Organization Code</source>
            <target>code de l'organisation</target>
            <note>Text located: body/table</note>
         </trans-unit>
         <trans-unit id="b47a7958" maxbytes="4000" maxwidth="26" size-unit="char" translate="yes">
            <source>Organization Name</source>
            <target>Nom De L'Organisation</target>
            <note>Text located: body/table</note>
         </trans-unit>
      </body>
   </file>
</xliff>

Step 5: Upload the new file XX_TEST_DEMO_TEMPLATE_fr_00.xlf as below:

Execution:

What is the next step? Nothing but to run the concurrent program with desired language selected. If you are going with only Option 1, you have to select the template language from SRS Submission form -> Options Button.

Note 1: the LOV for the Template Language is having only two languages as we have created the .rtf template in English and uploaded the translation for French language only.

Note 2: This is an extra step for the user every time he/she wants to submit the program through SRS form. Many user would like to have the language as a parameter which you can accomplish through MLS Function (Option 3). Option 2 is a prerequisite for Option 3. To know about MLS function, you can read our blog here.

 

Output:

Finally the output of the .rtf template will be translated into desired language (in this case French). In our example the .rtf template looks like below

Organization Code

Organization Name

<?for-each:G_ORGS?><?ORG_CODE?>

<?ORG_NAME?><?end for-each?>

and the corresponding french translation output will be

Comments