Blog navigation

Latest posts

Exploring the ATEXTRA Table for Storing Translated Text in Applications

 

What is ATEXTRA?

The ATEXTRA table, established since Adonix (1997), is a vital tool for storing translated text within applications. This table plays a key role in managing text that requires translation for the application's interface.

One noteworthy limitation of this approach relates to the size of text boxes. Each box can hold a maximum of 80 characters.

It's crucial to acknowledge that exceeding the 80-character limit will result in text being truncated.

Real-world usage examples can be found on screens [M:ITM0] and [M:ITM1].

Exploring Variable Types for Your Text Length Needs

  • AX1: Maximum of 12 characters
  • AX2: Maximum of 20 characters
  • AX3: Maximum of 30 characters
  • AXX: Maximum of 80 characters. This type allows you to set the length directly on the screen. Keep in mind that attempting to exceed 80 characters won't be effective due to constraints in the ATEXTRA.src 4GL source code, which leads to text truncation.

How is Translated Data Stored in the ATEXTRA Table?

The ATEXTRA table is structured with several key columns:

  • CODFIC: The table linked to the translation
  • ZONE: The screen box's name
  • LANGUE: Translation language (e.g., FRA for French, ENG for English)
  • LANORI: Original language (optional)
  • IDENT1: First index
  • IDENT2: Second index
  • TEXTE: Translated text

The indices (IDENT1 + IDENT2) are pivotal for each table. They facilitate precise translation retrieval from the database.

For standard tables already integrated with ATEXTRA, altering these indices isn't feasible.

Illustrative Example:

GACCOUNT: Account (GESGAC)

  • IDENT1 = GACCOUNT.COA
  • IDENT2 = GACCOUNT.ACC

VATBOX : VAT Cases (GESVTB)

  • IDENT1 = VATBOX.VATFNC
  • IDENT2 = VATBOX.LEG + «~» + VATBOX.LIN

GTYPACCENT : Document type (GESGTE)

  • IDENT1 = GTYPACCENT.TYP
  • IDENT2 = GTYPACCENT.LEG

TABVACBPR : BP tax rule (GESTVB)

  • IDENT1 = TABVACBPR.VACBPR
  • IDENT2 = TABVACBPR.LEG

TABVACITM : Tax level (GESTVI)

  • IDENT1 = TABVACITM.VACITM
  • IDENT2 = TABVACITM.LEG

TABVAC : Tax determination (GESTVC)

  • IDENT1 = TABVAC.COD
  • IDENT2 = TABVAC.LEG

TABVAT : Tax rate (GESTVT)

  • IDENT1 = TABVAT.VAT
  • IDENT2 = TABVAT.LEG

Utilizing ATEXTRA in Practice

Standard ATEXTRA Read

Refer to screen [M:ITM0] for an instance.

Screenshot of screen [M:ITM0] Screenshot of screen [M:ITM0] Screenshot of screen [M:ITM0]

Using 4GL to Read ATEXTRA

# Method 1 : Reading ATEXTRA with 2 index

Call LECTEXTRA([M :XS4L1]DES1AXX( nolign-1), »XSTRXX4L », »DES1AXX »,[L]XIDENT1,[L]XIDENT2) From ATEXTRA

# Method 2 : Reading ATEXTRA with 2 index

[M :XS4L1]DES1AXX([F :XS4L1]LIN-1) = func AFNC.TEXTRA(« XSTRXX4L », »DES1AXX »,[L]XIDENT1,[L]XIDENT2)

[M :XS4L1]DES2AXX([F :XS4L1]LIN-1) = func AFNC.TEXTRA(« XSTRXX4L », »DES2AXX »,[L]XIDENT1,[L]XIDENT2)

[M :XS4L1]DES3AXX([F :XS4L1]LIN-1) = func AFNC.TEXTRA(« XSTRXX4L », »DES3AXX »,[L]XIDENT1,[L]XIDENT2)

# Method 3 : Reading ATEXTRA with 1 index

Call CHARGE_DEFITMDES(« DES1AXX »,GLANGUE,[F :XS4LD]INDX,[M :XS4L1]DES1AXX( nolign), « [F :XS4LD] ») From TRTX3

# Method 4 : Reading ATEXTRA with 1 index

Call CHARGE_ITMDES(« DES1AXX »,GLANGUE,[F :XS4LD]INDX,[M :XS4L1]DES1AXX([F :XS4LD]LIN)) From TRTX3

# Method 5 : Reading ATEXTRA with 1 index

Call GET_ATEXTRA(« XSTRXX4LD », »DES1AXX »,GLANGUE,[M :XS4L1]DES1AXX([F :XS4LD]LIN)) From TRTX3TEX

Importing Specific Tables into ATEXTRA using 4GL

$IMP_ATEXTRA

If [F:XX4LSTR]LIN > 0

[L]XIDENT1 = [F:XX4LSTR]COA+[F:XX4LSTR]RPTCOD+ num$([F:XX4LSTR]YEA)

[L]XIDENT2 = [F:XX4LSTR]RPTBOX

Read [F:AXX] AXX0="XX4LSTR";"DES1AXX";[L]XLANGUE;[L]XIDENT1;[L]XIDENT2

[F:AXX]TEXTE = left$([M:XX4LSTR1]DESAXX([F:XX4LSTR]LIN-1),80)

If ! fstat

Rewrite [F:AXX]

Else

Gosub ATEXTRA_HEADER

[F:AXX]ZONE = "DES1AXX"

Write [F:AXX]

Endif

If len( mid$([M:XX4LSTR1]DESAXX([F:XX4LSTR]LIN-1),81,80)) > 0

Read [F:AXX] AXX0="XX4LSTR";"DES2AXX";[L]XLANGUE;[L]XIDENT1;[L]XIDENT2

[F:AXX]TEXTE = mid$([M:XX4LSTR1]DESAXX([F:XX4LSTR]LIN-1),81,80)

If ! fstat

Rewrite [F:AXX]

Else

Gosub ATEXTRA_HEADER

[F:AXX]ZONE = "DES2AXX"

Write [F:AXX]

Endif

Endif

If len( mid$([M:XX4LSTR1]DESAXX([F:XX4LSTR]LIN-1),161,80)) > 0

Read [F:AXX] AXX0="XX4LSTR";"DES3AXX";[L]XLANGUE;[L]XIDENT1;[L]XIDENT2

[F:AXX]TEXTE = mid$([M:XX4LSTR1]DESAXX([F:XX4LSTR]LIN-1),161,80)

If ! fstat

Rewrite [F:AXX]

Else

Gosub ATEXTRA_HEADER

[F:AXX]ZONE = "DES3AXX"

Write [F:AXX]

Endif

Endif

Endif

Return

 
Posted in: Sage X3, Configuration, 4GL