Class LocaleIdentifierValidator
java.lang.Object
org.ek9lang.compiler.common.LocaleIdentifierValidator
Authoritative validator for EK9 locale identifiers used in
defines text for "<locale>"
blocks. The regex matches Phase 1's TextLanguageExtraction rule exactly — both
point at this class so editor pre-call validation and compiler diagnostic emission share
a single source of truth (compiler error E07900 INVALID_VALUE).
Format: lowercase language code, optionally followed by an underscore and an uppercase country code:
- VALID:
en,en_GB,de,fr_FR,ja_JP - INVALID:
"EN"(uppercase base),"EN_US"(uppercase base),"en-US"(hyphen separator),"en_us"(lowercase country)
-
Field Details
-
LOCALE_PATTERN
The EK9 locale-identifier pattern. Used byTextLanguageExtractionfor Phase 1 SYMBOL_DEFINITION validation and by editor tools for pre-call validation. -
LOCALE_REGEX
The regex source as a string — useful in tool documentation and error messages.- See Also:
-
-
Method Details
-
isValidLocale
- Parameters:
locale- the locale identifier to validate (no surrounding quotes)- Returns:
trueif the locale matches the EK9 locale-identifier rule
-