Skip to content

feat(l10n): localize AI services, English system prompt - #17

Merged
osmcgrgenc merged 2 commits into
mainfrom
l10n/ai-services
Sep 28, 2026
Merged

osmcgrgenc merged 2 commits into
mainfrom
l10n/ai-services

Conversation

@osmcgrgenc

Copy link
Copy Markdown
Contributor

Summary

Localizes the AI services layer into the ai table:

  • LocalHeuristicProvider: offline insight titles, summaries, categories, action titles and chat replies
  • NvidiaNIMProvider: display name, analysis title and category
  • AIAssistantService: chat action titles and the connection-error reply
  • NvidiaNIMService: user-visible errors and connection-test status messages

Keys: 49 new keys. 47 go in ai.strings (en and tr, appended). 2 counted keys go in a new ai.stringsdict (en and tr): %lld App Updates Available and NVIDIA NIM connection successful! %lld models scanned.. Two existing keys are reused: Local Rule Engine (100% Offline & Secure) and Scan for Junk Files.

Prompt approach

  • The model instructions sent to NVIDIA NIM are now in English and are not localized through the tables. They tell the model to reply in the app's current UI language:
    • Copilot system prompt: You are the MacOptimizer Pro macOS assistant. Reply in <Language>; only offer recommendations, never execute actions. System summary: <snapshot>
    • Diagnosis prompt: Mac: <model>, <chip>, <os>. RAM N%, CPU N%, Free disk N%, Junk files <size>, Apps with pending updates: N. Give short system recommendations. Reply in <Language>.
    • Running-app suffix (sent only when the opt-in is on): \nRunning apps: ...
    • Connection probe: Reply briefly.; the path-redaction token is now [file path]
  • How the language is chosen: new L10n.currentLanguage() (the same AppleLanguages → Bundle.module.localizations match that L10n.string already used, now shared) and L10n.currentLanguageEnglishName(), which returns "Turkish" or "English" via Locale(identifier: "en"). If nothing matches, it falls back to the bundle's development localization.
  • Privacy rules are unchanged: app names and PIDs are sent only with the opt-in, file paths are redacted, the API key stays out of the body, and the history cap is still 6 chat messages (7 with the system message).

Keyword matching

Keyword lists were extended, not replaced, so both Turkish and English input still match (for example memory, heat, clean, space, storage, junk, cache, new version, network).

Tests

  • Payload test updated for the English wording. It still checks the opt-in, no file path, no API key, and the 7-message cap.
  • New testNIMPromptsAreEnglishAndNameReplyLanguage: the system prompt names the reply language, and the language resolves to Turkish or English from AppleLanguages.
  • New testCopilotKeywordsMatchTurkishAndEnglishInput.
  • Full suite: 85 tests, 0 failures, including localization completeness.

🤖 Generated with Claude Code

@osmcgrgenc
osmcgrgenc merged commit 8b7b4fb into main Sep 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant