Article

CURRENT-LANGUAGE change fails with persistent procedures

Information

 
Article Number000064499
EnvironmentOpenEdge
10.x, 11.x
Windows
Question/Problem Description
CURRENT-LANGUAGE change fails with persistent procedures

Changing CURRENT-LANGUAGE and then running a persistent procedure, the persistent procedure does not always use the new language.

For example, a persistent child procedure has a English and German text segment.  The following code fails to use the German text segment in this procedure at all:
 
DEF VAR h_English AS HANDLE.
DEF VAR h_German AS HANDLE.
CURRENT-LANGUAGE = ?.

/* This should (and does) use the "English" text segment */
RUN tranman\progs\pEnglish.w PERSISTENT SET h_English. 
MESSAGE CURRENT-LANGUAGE SKIP
    VALID-HANDLE(hProc) SKIP
    hProc:PERSISTENT
    VIEW-AS ALERT-BOX INFO BUTTONS OK.

CURRENT-LANGUAGE = "German".
/* This should (but doesn't) use the "German" text segment */
RUN tranman\progs\pEnglish.w PERSISTENT SET h_German.

 
Steps to Reproduce
Clarifying Information
Error Message
Defect/Enhancement Number
Cause
This is expected behavior.  Setting the CURRENT-LANGUAGE (even to itself) should cause the cache of r-code to be purged of all *UNUSED* r-code.  However if the r-code has an active persistent procedure at the time the CURRENT-LANGUAGE is set, it is NOT unused and therefore cannot be purged.  The CURRENT-LANGUAGE value is examined when r-code is loaded.  If the r-code is already in the cache, it is not reloaded. 

Any change to this behaviour would be a product enhancement.  
Resolution
Delete the persistent procedure before changing the language.  For example:
 
/* Delete the procedure before changing the language */

DELETE PROCEDURE h_English.
CURRENT-LANGUAGE = "German".
RUN tranman\progs\pEnglish.w PERSISTENT SET h_German.

Alternatively use an include file for the core code and create different procedures (and r-code) for each language.  For example:

- pEnglish.i - contains all application code.
- pEnglish.p - English procedure - contains {pEnglish.i}
- pGerman.p - German procedure - contains {pEnglish.i}

Then translate and compile each procedure and run either pEnglish.p or pGerman.p in the code.
Workaround
Notes
Attachment 
Last Modified Date4/25/2018 1:34 PM


Feedback
 
Did this article resolve your question/issue?

   

Your feedback is appreciated.

Please tell us how we can make this article more useful. Please provide us a way to contact you, should we need clarification on the feedback provided or if you need further assistance.

Characters Remaining: 1025