bcquality/microsoft/knowledge/style/labels-declared-at-object-scope.md
wenjiefan 5f1cff2fb6 Refine self-improvement review guidance
Narrow IsHandled, label-scope, UI-handler, checkpoint, and bulk-operation guidance to evidence-backed false-positive boundaries.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-08-18 11:17:14 +02:00

1.4 KiB

bc-version domain keywords technologies countries application-area
all
style
label
scope
procedure
translation
localization
xliff
false-positive
al
w1
all

Procedure-local Labels are valid

Description

The AL language supports Label variables at both object and procedure scope. Microsoft documents the Label data type without imposing an object-scope requirement, and the translation pipeline generates an XLF file containing all labels used by the extension. There is no documented correctness or localization defect caused solely by declaring a Label in a procedure-local var block.

Best Practice

Choose object scope when a Label is reused or when an established repository convention prefers central declarations; choose procedure scope when the Label belongs to one procedure. Do not report a correctness or localization finding solely because a Label is local. An explicit object-scope convention is at most a low-severity maintainability preference. This guidance applies equally to production and test apps: test code still needs localization where its strings are user-facing or translator-facing.