Releases: cplieger/langtag
Release list
v2.0.1
v2.0.0
Breaking changes
Carry comparison direction in a constructed Preference role
The module path moves to github.com/cplieger/langtag/v2.
The four positional directional functions - Compare(want, have),
Reason(want, have), Match(want, have, floor) and Best(want, ...) - are
replaced by a Preference constructed once from the wanted side
(langtag.Prefer(want) or c.Prefer(want)) and asked about offers:
p.Compare(have), p.Reason(have), p.Match(have, floor), and
Best(p, candidates, tagOf, floor) (a function because a method cannot
declare tagOf's type parameter as of Go 1.26). BestWith is folded into
Best via c.Prefer. Grading semantics are byte-identical; the direction
oracle tests pass unchanged. The zero Preference and a nil-*Comparer
Preference both fail CLOSED (TierNone everywhere) - a nil table judges
nothing acceptable rather than inheriting the widest table the package
ships. Preference gains Want() and String() for the build-once idiom;
Fallback documents its authoring-direction seam.
Make Best a method on Preference
The package-level Best function is gone. Call it on the
preference instead: langtag.Best(langtag.Prefer(want), candidates, tagOf,
floor) becomes langtag.Prefer(want).Best(candidates, tagOf, floor), and
c.Prefer(want).Best(...) for a custom table. Because Best is now a generic
method it cannot appear in an interface, so a caller abstracting over
selection wraps it in a non-generic method. v2 now requires the Go 1.27
toolchain. The v2 major is unreleased, so no published version carried the
old form.
Added
- [breaking] Carry comparison direction in a constructed Preference role
Changed
- Return the built-in tables through slices.Clone
- [breaking] Make Best a method on Preference
Dependencies
- Raise the go directive to Go 1.27.0
v1.0.5
Dependencies
- Update dependency go to v1.26.7 (#10)
v1.0.4
Fixed
- Put Serbian's two scripts on the same-language tier
v1.0.3
Fixed
- Keep the farther tier when two entries claim one pair, and add Comparer.Match
v1.0.2
Fixed
- Fail closed on a malformed fallback table and an unusable floor
v1.0.1
Fixed
- Split cross-language fallbacks into intelligible and shared-literacy tiers
v1.0.0
Added
- Tier-graded BCP 47 language tag matching