PDFium Delphi Component Docs

IsPdfUaLanguageTagValid function

Unit: PDFium
Performs the syntactic BCP 47 / RFC 1766 check required by ISO 14289-1 clause 7.2 for /Lang values

Syntax

function IsPdfUaLanguageTagValid(const Tag: WString): Boolean;

Parameters

TagWString

Return Value

Boolean

Description

IsPdfUaLanguageTagValid validates the shape of a language tag as used in catalogue /Lang, structure element /Lang, and marked-content /Lang entries

A tag is a primary subtag of 1 to 8 ASCII letters, followed by zero or more hyphen-separated subtags of 1 to 8 ASCII letters or digits. This is the ^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$ grammar required by ISO 14289-2 8.4.4/2 and ISO 14289-1 7.2/29

Leading hyphens, consecutive hyphens, trailing hyphens, empty tags and overlong subtags such as portugues-pt or nl-1234abcde are invalid

Remarks

Example

Valid := IsPdfUaLanguageTagValid(Pdf.Language);

See Also

ResolvePdfUaEffectiveLanguage, ValidatePdfUaStructureElements, TPdf.InspectPdfUaLanguageCoverage, TPdf.Language