Kbase 19196: How to get translations when compiling on the fly?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/14/1999 |
|
How to get translations when compiling on the fly?
Translated text is a part of r-code text segment which is generated during a compilation (COMPILE ... LANGUAGES statement). When compiling on the fly, there is no syntax to pass this information onto the compiler (RUN code.p).
The compiler matches translations by string content, string attribute and source file-name.
To get translation into programs compiled on the fly, follow these steps:
1) Create a source file with all the strings that might be translated and save it as "flyrep.p"
2) Run TranMan to load the file into a project db and do the translations
3) At run-time generate generate the code (report) with the exact same name
4) From the program use the COMPILE statement with LANGUAGES option to generate the r-code
5) From the program RUN flyrep.p
Here is an example:
1) Create the file with all the strings:
/* flyrep.p
contains all strings that have to be translated
*/
DEF VAR t1 AS CHAR INIT "Text to be translated" NO-UNDO.
DEF VAR t2 AS CHAR INIT "This one as well" NO-UNDO.
DEF VAR t3 AS CHAR INIT "And another one" NO-UNDO.
DEF VAR t4 AS CHAR INIT "DATE" NO-UNDO.
DEF VAR t5 AS CHAR INIT "PAGE" NO-UNDO.
/* flyrep.p - end */
2) Load and translate strings in the TM
3) Write a procedure that - generates, compiles and runs the report:
/* genfile.p
generates, compiles and runs the flyrep.p
*/
/* Generate the flyrep code */
OUTPUT TO flyrep.p.
PUT UNFORMATTED
'DEF VAR d1 AS DATE LABEL "DATE" NO-UNDO.' SKIP
'DEF VAR p1 AS INTEGER LABEL "PAGE" NO-UNDO.' SKIP(2)
'DISPLAY "Text to be translated" SKIP' SKIP
' "This one as well" SKIP' SKIP
' "And another one" SKIP' SKIP
' WITH FRAME a. ' SKIP(2).
PUT UNFORMATTED
'ASSIGN d1 = TODAY ' SKIP
' p1 = 1.' SKIP
'DISPLAY d1 p1 WITH FRAME b.'.
OUTPUT CLOSE.
/* For compilation, we have to connect to TM project database */
CONNECT tmtest -1 -ld xlatedb.
/* Compile it */
COMPILE flyrep.p SAVE LANGUAGES ("mylang").
/* Run it with the translation */
CURRENT-LANGUAGE = "mylang".
RUN flyrep.
/* Run it with the source language */
CURRENT-LANGUAGE = "".
RUN flyrep.
DISCONNECT xlatedb.
/* End of procedure */
VZA (Oct 14 1999)