Repository navigation
API Overview
Enbrea.Bcp47 is split into a registry-independent core package and an optional IANA registry package.
Most applications interact primarily with LanguageTag, LanguageTagBuilder, LanguageRange, and the matching APIs. Enbrea.Bcp47.Iana adds registry validation and registry metadata access.
Represents a parsed BCP 47 language tag.
Use it to:
- parse and try-parse language tags
- test well-formedness and structural validity
- normalize language-tag strings
- inspect normalized components
- preserve the original input through
Value - obtain the normalized representation through
ToString() - compare tags by normalized value
Important properties include:
Value
Language
Extlangs
Script
Region
Variants
Extensions
PrivateUse
IsGrandfathered
IsPrivateUseOnlyStatic convenience methods include:
LanguageTag.Parse(...)
LanguageTag.TryParse(...)
LanguageTag.IsWellFormed(...)
LanguageTag.IsStructurallyValid(...)
LanguageTag.Normalize(...)
LanguageTag.TryNormalize(...)See Parsing and Validation and Normalization and Equality.
Provides the underlying registry-independent RFC 5646 parser and normalizer.
Public operations include:
Bcp47Parser.Parse(...)
Bcp47Parser.TryParse(...)
Bcp47Parser.IsWellFormed(...)
Bcp47Parser.IsStructurallyValid(...)
Bcp47Parser.Normalize(...)
Bcp47Parser.TryNormalize(...)Most application code can use the corresponding static methods on LanguageTag. Bcp47Parser remains useful when an explicit parser-oriented API is preferred.
Provides fluent construction of language tags.
Component methods are:
.Language(...)
.Extlang(...)
.Script(...)
.Region(...)
.Variant(...)
.Extension(...)
.PrivateUse(...)
.Build()Create a builder from an existing decomposable tag with:
LanguageTagBuilder.From(tag)Represents one extension sequence in a parsed language tag.
Properties:
Singleton
SubtagsInstances are created by the parser rather than directly by application code.
Represents a parsed RFC 4647 basic or extended language range.
Properties:
Value
Subtags
IsBasic
IsWildcardToString() returns the lowercase normalized range.
See Language Ranges.
Parses and validates language ranges.
Public operations:
LanguageRangeParser.Parse(...)
LanguageRangeParser.TryParse(...)
LanguageRangeParser.ParseBasic(...)
LanguageRangeParser.TryParseBasic(...)
LanguageRangeParser.IsBasic(...)
LanguageRangeParser.IsExtended(...)Implements RFC 4647 matching.
Filtering:
Bcp47Matcher.BasicFilter(...)
Bcp47Matcher.ExtendedFilter(...)Single-match checks:
Bcp47Matcher.IsBasicMatch(...)
Bcp47Matcher.IsExtendedMatch(...)Lookup:
Bcp47Matcher.Lookup(...)Filtering and Lookup have overloads for a single range and for a language priority list.
Provides convenient single-range matching methods:
range.IsBasicMatch(tag)
range.IsExtendedMatch(tag)
range.BasicFilter(tags)
range.ExtendedFilter(tags)
range.Lookup(tags)The static Bcp47Matcher API remains the natural choice for range priority lists.
Adds registry-aware validation on top of the core parser.
Public operations:
IanaLanguageTagValidator.IsValid(...)
IanaLanguageTagValidator.Validate(...)
IanaLanguageTagValidator.IsDeprecated(...)IsValid() and Validate() accept either a raw string or a parsed LanguageTag where applicable.
See IANA Validation.
The IANA package adds convenience methods to parsed tags:
tag.IsIanaValid()
tag.ValidateIana()
tag.IsDeprecated()Represents a detailed IANA validation result.
Properties:
IsValid
Error
Subtag
SubtagTypeA successful result is also available through:
IanaLanguageTagValidationResult.SuccessDescribes why IANA validation failed.
Available values:
None
StructurallyInvalid
UnregisteredGrandfatheredTag
UnregisteredLanguage
UnregisteredExtlang
UnregisteredScript
UnregisteredRegion
UnregisteredVariant
Provides direct access to the bundled registry snapshot.
Registry information includes:
- membership by record type
- snapshot file date
- deprecation state
- preferred values
- language and extlang macrolanguages
- language and extlang suppress-script values
- extlang prefixes
- variant prefixes
- grandfathered and redundant complete tags
See IANA Registry.
Identifies the registry record type:
Language
Extlang
Script
Region
Variant
Grandfathered
Redundant
Use only Enbrea.Bcp47 when grammar, normalization, construction, ranges, and matching are sufficient.
Add Enbrea.Bcp47.Iana when application behavior depends on the bundled IANA registry snapshot.
This separation keeps the core parser deterministic and registry-independent while allowing applications to opt into registry-aware behavior explicitly.