Use the Tok suffix for token labels
Properties
AC0027
Info
Design
Code Fix
Ignore Obsolete
When a locked label’s value matches its variable name, the label is a fixed token — a technical identifier that must never be translated. Naming it with a Lbl or Txt suffix signals translatable text, which misleads translators working in .xlf files and developers maintaining the code. A translator who sees ApiVersionLbl may assume the string is user-facing and unlock it for localization, causing an API call to send a translated string where a fixed English token was expected.
Rename the variable to use the Tok suffix instead.
Example
The following label is locked and its value matches the variable name (after stripping the Lbl suffix), but uses the wrong suffix:
codeunit 50100 MyCodeunit
{
var
ApiVersionLbl: Label 'ApiVersion', Locked = true; // Use the 'Tok' suffix for token labels [AC0027]
}Replace the Lbl suffix with Tok:
codeunit 50100 MyCodeunit
{
var
ApiVersionTok: Label 'ApiVersion', Locked = true;
}When the diagnostic is reported
- The label has
Locked = true. - The label text matches the variable name after stripping any approved suffix
(
Msg,Tok,Err,Qst,Lbl,Txt). The comparison is case-insensitive and ignores non-alphanumeric characters in the label text —MyLabelTxt: Label 'My Label.', Locked = truealso triggers. - The variable does not already use the
Toksuffix.
See also
- AC0020 - Labels suffixed with Tok must be locked
- AC0021 - Locked Label must have a suffix Tok
- CodeCop Warning AA0074 - TextConst and Label variable names should have an approved suffix