Repository navigation
fix(apple): return the current locale as a bcp 47 code without keywords - #334
Conversation
When language and region differ, the locale identifier carries keywords such as en_US@rg=plzzzz. It is the default language of the speech, transcription and embedding models, and AVSpeechSynthesisVoice does not accept it, so getCurrentLocale() now returns en-US. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Build locale code packages/apple-llm/ios/utils/AppleUtils.mm |
getCurrentLocale joins the language code with available script and country codes instead of returning localeIdentifier. |
Priority:
Estimated code review effort: 2 (Simple) | ~5 minutes
Change: Bug fix
Possibly related PRs
- callstackincubator/ai#316: This PR selects a language for Apple speech synthesis and can use
getCurrentLocaleas its default language source.
Merge Risk: 
Minimal · up to 1168b
-
No current merge-blocking risk was established for this locale-formatting change.
Architecture risk: 
Low · up to 1168b
-
The change affects 1 system.
Changed systems:
packages/apple-llmArchitecture concerns
No architecture-level concerns identified.Review details
-
Systems and components
- observed — packages/apple-llm (library) was modified; 1 changed file maps to changed impact.
Before / after behavior
- observed — Modified behavior in packages/apple-llm/ios/utils/AppleUtils.mm:
getCurrentLocalereplaceslocaleIdentifierwith a hyphen-joined code containing the language, followed by the script and country when present.
-
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Stacked on #333.
AppleUtils.getCurrentLocale()returnedNSLocale.currentLocale.localeIdentifier. When the device's language and region differ, that identifier carries keywords such asen_US@rg=plzzzz. It's the default language of the speech, transcription and embedding models, andAVSpeechSynthesisVoice(language:)expects a code likeen-US.It now returns a BCP 47 code built from the locale's language, script and region, without keywords:
en-US, orzh-Hans-CN.An earlier attempt (
00786b6c, reverted ind4fdc92con the reasoning-level branch) only targeted transcription, which turned out not to need it, sinceSpeechTranscriberresolves such locales itself. Speech synthesis and thegetCurrentLocale()contract still did.The existing
reads the current localeharness test failed onmainon simulators whose locale has a region override (en_US@rg=plzzzzhere) and passes now. Availability and speech tests pass on the iPhone 18 Pro simulator (iOS 27).🤖 Generated with Claude Code
Summary by CodeRabbit