Localize report output for multiple languages

Completed

Once the dataset and layout contract is stable, localization makes the report usable across language settings. A localized report separates translatable text from AL logic and keeps values in types that Business Central can format for the report language.

Define translatable report text

Use AL Label values for captions, headings, validation messages, and other user-facing text. A label carries a source string and can include a Comment that gives translators context. Avoid constructing sentences from several labels because word order and grammar vary by language.

Expose labels to a layout as dataset columns when the layout needs them:

column(ReportTitle; ReportTitleLbl) { }
column(BalanceCaption; BalanceCaptionLbl) { }

var
    ReportTitleLbl: Label 'Customer balance review',
        Comment = 'Title shown at the top of the customer report';
    BalanceCaptionLbl: Label 'Balance (LCY)',
        Comment = 'Caption for a customer balance in local currency';

Captions on report, request-page, and dataset elements also enter the translation workflow. Keep identifiers stable and use comments when a short source string has more than one possible meaning.

Manage XLIFF translations

Add the TranslationFile feature in app.json to generate an XML Localization Interchange File Format (XLIFF) source file when you build the extension. Business Central writes the generated .g.xlf file in the Translations folder. Treat that file as the source catalog rather than editing it as a target translation.

To add a language, copy the generated file to a target file, set its target-language, and add a <target> element for each translated <source> element. Preserve each translation unit identifier so the compiler and translation tooling can match the target to the AL label. Rebuild after labels change, and use an XLIFF-aware comparison process to identify added, changed, and removed source strings.

Translation includes more than visible layout headings. Include request-page captions, tooltips, validation messages, and labels exposed through the dataset. Test the target XLIFF file as part of the extension package rather than relying on source-string review alone.

Apply language-aware formatting

Keep dates, decimals, and currency values typed in the dataset whenever the layout can format them. Typed values support sorting, totals, and locale-aware presentation. If a layout requires preformatted text, the AL Format method uses the report's current language and format expression.

The report language can differ from the user's display language. A document report commonly sets its language from recipient data before values are formatted. Apply the language before the report evaluates labels and format expressions, and restore or isolate language changes so one record doesn't affect another unexpectedly.

Validate localization with representative values:

  • Check translated labels in the rendered layout.
  • Check decimal separators, date order, and currency display.
  • Check long translations for clipping or unwanted page breaks.
  • Check validation messages and request-page controls.
  • Check fallback behavior when a target translation is missing.

For label syntax and translation setup, see Work with labels and Multilanguage development.