Usina BRAdvPL Guide
Sign in
← All topics
FOUNDATIONUnder review

Text internationalization through includes

#Define → .ch file → #Include → compilation

Separates messages from code through compile-time constants.

Text internationalization through includesAdvPL
01 · OVERVIEW

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.)

02 · SYNTAX

Syntax

#Define → .ch file → #Include → compilation
03 · PRACTICAL EXAMPLE

Commented 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 Nil
Expected result

Displays 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.

BEST PRACTICES
  • 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.

Related content

REFERENCES
  1. Waterloo Ferreira da Silva. AdvPL — O Manual, versão 1.0; p. 77. Referência histórica. Accessed on 2026-10-27.
  2. Waterloo Ferreira da Silva. AdvPL — O Manual, versão 1.0; p. 96. Referência histórica. Accessed on 2026-10-27.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha