In any Oracle Reports Services application, you see many types of messages, including:
Error messages from the database
Runtime error messages produced by Oracle Reports Services
Messages and boilerplate text defined as part of the application
NLS_LANG environment variable is set correctly and the appropriate message files are available, then translation of messages for the first two items is done for you. To translate messages and boilerplate text defined as part of the application, you can use the Oracle translation tool, TranslationHub, and you might also find it useful to use PL/SQL Libraries for strings of code.
Note:You'll find information about using TranslationHub on your Oracle Developer Suite documentation CD and on the Oracle Technology Network (
Manual translation is required for constant text within a PL/SQL block because that text is not clearly delimited, but is often built up from variables and pieces of strings. To translate these strings, you can use PL/SQL libraries to implement a flexible message structure.
You can use attachable PL/SQL libraries to implement a flexible message function for messages that are displayed programmatically by the
SRW.MESSAGE built-in procedure, or by assigning a message to a display item from a trigger or procedure. The library can be stored on the host and dynamically attached at runtime. At runtime, based on a search path, you can pull in the attached library. For example, a library might hold only the Italian messages:
FUNCTION nls_appl_mesg(index_no NUMBER) RETURN CHAR IS msg CHAR(80); BEGIN IF index_no = 1001 THEN msg := 'L''impiegato che Voi cercate non esiste...'; ELSIF index_no = 1002 THEN msg := 'Lo stipendio non puo essere minore di zero.'; ELSIF ... . . ELSE msg := 'ERRORE: Indice messaggio inesistente.'; END IF; RETURN msg; END;
A routine like this could be used anywhere a character expression would normally be valid. For example, to display text with the appropriately translated application message, you might include the following code:
Note:For a description of the
SRWbuilt-in package, including the
SRW.MESSAGEbuilt-in procedure, see the Oracle Reports online Help.
To change the application to another language, simply replace the PL/SQL library containing the
nls_appl_mes function with a library of the same name containing the
nls_appl_mesg function with translated text.