Text internationalization through includes
#Define → .ch file → #Include → compilationSeparates messages from code through compile-time constants.
Overview
The historical manual recommends centralizing text in the source’s associated include. #Include inserts content during preprocessing; it is not by itself dynamic translation based on user language. This example combines a fictional header and source, using ED_LANG_EN/ES as example-owned conventions, not official symbols. Compile each variant and check encoding and length. (Sources: refs. 1–2.)
Syntax
#Define → .ch file → #Include → compilationCommented example
// EdMessages.ch: example-owned conventions.
#IfDef ED_LANG_EN
#Define ED_MSG "Ready"
#Else
#IfDef ED_LANG_ES
#Define ED_MSG "Listo"
#Else
#Define ED_MSG "Pronto"
#EndIf
#EndIf
// EdExample.prw: save the header above separately.
#Include "Protheus.ch"
#Include "EdMessages.ch"
User Function Ed493()
ConOut(ED_MSG)
Return NilDisplays the compile-time selected text without runtime language switching. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Keep identical keys and placeholders across translations. Do not translate API identifiers or field names.
- Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.