certTargetLabel function

String certTargetLabel(
  1. AppLocalizations l10n,
  2. Certification cert
)

Localized display labels for the certification/compliance entities.

Certification and ComplianceRequirement live in the domain layer, which is plain Dart with no Flutter dependency, so they cannot reach an AppLocalizations. Their targetLabel / validityLabel / appliesToLabel getters therefore return English. These functions are the presentation-layer equivalents and are what the screens render — same split as orgRoleLabel and masteryLevelLabel.

The persisted values (appliesTo, requiredMastery, status) stay untranslated on the wire; only their presentation is localized. What a certification is earned against — a learning path or a domain.

Falls back to a generic noun when the join did not return a name, which is the only part of the label that needs translating; pathName/domainName are user-authored content and pass through as-is.

Implementation

/// What a certification is earned against — a learning path or a domain.
///
/// Falls back to a generic noun when the join did not return a name, which is
/// the only part of the label that needs translating; `pathName`/`domainName`
/// are user-authored content and pass through as-is.
String certTargetLabel(AppLocalizations l10n, Certification cert) =>
    cert.isPathBased
    ? (cert.pathName ?? l10n.orgCertTargetPath)
    : (cert.domainName ?? l10n.commonDomain);