fix: resolve bare detected-language tags to the user's regional spelling dictionary#41
Open
hiimdec wants to merge 1 commit into
Open
fix: resolve bare detected-language tags to the user's regional spelling dictionary#41hiimdec wants to merge 1 commit into
hiimdec wants to merge 1 commit into
Conversation
…onary
NLLanguageRecognizer only emits base tags ("en"), which both spell-language
resolvers exact-matched to the generic "en" dictionary — US-flavoured, so on
a British-English Mac the typo guard killed branches closing colour/realise/
organise and the dead-end guard suppressed completions mid-word ("colou" has
zero completions under "en"). New shared SpellingLanguage.resolve refines a
bare base tag with the user's preferred regional variant (Locale.
preferredLanguages, per ADR-089's precedent) before falling back. ADR-116.
Verified by compiling the real source with a harness against the live
NSSpellChecker: en→en_GB on this system, British words recognised, US
behaviour unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NLLanguageRecognizeremits base tags only ("en", never"en-GB"), and both spell-language resolvers exact-match that againstNSSpellChecker.availableLanguages— landing on the generic"en"dictionary, which is US-flavoured. On a British-English system this makes the in-beam typo guard drop correctly-spelled branches (colour, realise), the dead-end guard suppress completions mid-word (completions("en", "colou")returns 0), and the correction lane liable to "fix" British spellings toward US.This PR adds a shared resolver (
SpellingLanguage.resolve): a bare base tag is first refined with the user's preferred regional variant of that language (Locale.preferredLanguages— the same OS-derived signal ADR-089 uses for prompt style) before falling back to exact match, base, andnil. US-preference systems are unchanged (en_USisn't an installed dictionary; resolution falls back to"en"as before); other languages with regional preferences (e.g.fr-CA) gain the same refinement. Verified against the live checker:en→en_GBon an en-GB system, British words recognised,color/realizestill flagged.Corresponds to ADR-116 in my fork's decision log; happy to adjust numbering/format to your conventions.
🤖 Generated with Claude Code