Skip to content

feat: add Turkish language support - #8

Merged
Svtter merged 2 commits into
sun-praise:mainfrom
umutuluer:feat/add-turkish-language-support
Sep 16, 2026
Merged

Svtter merged 2 commits into
sun-praise:mainfrom
umutuluer:feat/add-turkish-language-support

Conversation

@umutuluer

Copy link
Copy Markdown
Contributor

Summary

  • Add getLang() helper to centralize language resolution with fallback to "en"
  • Add Turkish translations for all dimension labels and prompts
  • Add Turkish translations for orchestrator, single-agent, fixer, and toggle prompts
  • Add Turkish translations for all 5 dimension review prompts (code-quality, security, performance, testing, documentation)
  • Add Turkish translation for output format templates and command descriptions
  • Update README to document "tr" language option

Test plan

  • Verify language: "tr" renders Turkish prompts for all agents
  • Verify language: "zh" still renders Chinese (no regression)
  • Verify language: "en" still renders English (no regression)
  • Verify unknown language falls back to "en"
  • Verify custom_rules still appear correctly in Turkish single-agent mode

@Svtter

Svtter commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR! 🇹🇷 The implementation is solid overall — getLang() genuinely centralizes language resolution (no stray config.language === "zh" ternaries remain), every language-keyed record has its tr key, and the fallback to "en" is consistent across all lookups, so there are no regression paths for zh/en. Findings below.

Must fix

  1. CHANGELOG.md not updated. The file declares "All notable changes to this project will be documented in this file" (Keep a Changelog). Please add an entry under ## [Unreleased] → ### Added for Turkish language support.

  2. Test plan not covered. The PR lists 5 manual verifications, but the repo's test script is still echo "TODO: add tests" && exit 0. Even a couple of unit tests for getLang() (known language passthrough, unknown → "en" fallback) would lock in the fallback contract the test plan relies on.

Suggestions (judgement calls)

  1. Repeated language cascades. if (lang === "zh") {…} if (lang === "tr") {…} return <english> now repeats in 4 functions (buildParallelPrompt, buildSinglePrompt, buildFixerPrompt, buildTogglePrompt). Consider a Record<SupportedLanguage, string> prompt map per function so adding a language touches exactly one place per prompt.

  2. Duplicated prompt blocks. The inline ## Çıktı Formatı / ## Otomatik Düzeltme sections in buildSinglePrompt's tr branch duplicate REPORT_FORMAT.tr / AUTO_FIX_INSTRUCTION.tr, and the wording has already drifted (the single-agent version is longer). Interpolate the shared constants like buildParallelPrompt does.

  3. Dead fallback. toggleDescriptions[lang] ?? toggleDescriptions.en in src/index.ts — getLang() already guarantees the result is one of {zh, en, tr}, so the ?? branch can never fire. Fine to drop.

  4. Minor: type casts. getLang() needs two as SupportedLanguage casts because ReviewConfig.language is typed string. A type guard ((SUPPORTED_LANGUAGES as readonly string[]).includes(...)) would remove both casts.

Nice-to-have

  • The fixed "### Custom Rules" heading from buildCustomRules stays English in tr mode — same as the zh branch, so it's pre-existing behavior rather than a regression; just noting it in case you want to localize it while touching this code.

Overall: functionality complete, no scope creep, zh/en unaffected. Items 1–2 are blocking from my side; 3–6 can land in this PR or a quick follow-up.

@umutuluer

umutuluer commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the PR! 🇹🇷 The implementation is solid overall — getLang() genuinely centralizes language resolution (no stray config.language === "zh" ternaries remain), every language-keyed record has its tr key, and the fallback to "en" is consistent across all lookups, so there are no regression paths for zh/en. Findings below.

Must fix

  1. CHANGELOG.md not updated. The file declares "All notable changes to this project will be documented in this file" (Keep a Changelog). Please add an entry under ## [Unreleased] → ### Added for Turkish language support.
  2. Test plan not covered. The PR lists 5 manual verifications, but the repo's test script is still echo "TODO: add tests" && exit 0. Even a couple of unit tests for getLang() (known language passthrough, unknown → "en" fallback) would lock in the fallback contract the test plan relies on.

Suggestions (judgement calls)

  1. Repeated language cascades. if (lang === "zh") {…} if (lang === "tr") {…} return <english> now repeats in 4 functions (buildParallelPrompt, buildSinglePrompt, buildFixerPrompt, buildTogglePrompt). Consider a Record<SupportedLanguage, string> prompt map per function so adding a language touches exactly one place per prompt.
  2. Duplicated prompt blocks. The inline ## Çıktı Formatı / ## Otomatik Düzeltme sections in buildSinglePrompt's tr branch duplicate REPORT_FORMAT.tr / AUTO_FIX_INSTRUCTION.tr, and the wording has already drifted (the single-agent version is longer). Interpolate the shared constants like buildParallelPrompt does.
  3. Dead fallback. toggleDescriptions[lang] ?? toggleDescriptions.en in src/index.ts — getLang() already guarantees the result is one of {zh, en, tr}, so the ?? branch can never fire. Fine to drop.
  4. Minor: type casts. getLang() needs two as SupportedLanguage casts because ReviewConfig.language is typed string. A type guard ((SUPPORTED_LANGUAGES as readonly string[]).includes(...)) would remove both casts.

Nice-to-have

  • The fixed "### Custom Rules" heading from buildCustomRules stays English in tr mode — same as the zh branch, so it's pre-existing behavior rather than a regression; just noting it in case you want to localize it while touching this code.

Overall: functionality complete, no scope creep, zh/en unaffected. Items 1–2 are blocking from my side; 3–6 can land in this PR or a quick follow-up.

Hi @Svtter

Thanks so much for taking the time to review this so thoroughly – I really appreciate all the detailed feedback you gave me.

I've addressed everything you mentioned:

  • Added Turkish language support to the Unreleased section in CHANGELOG.md.
  • Swapped out the test placeholder with actual Bun tests that cover language resolution and falling back to English when we don't support a language.
  • Added tests for the localized prompts – the orchestrator, fixer, toggle, and dimension ones – plus tests for the Turkish single-agent custom rules.
  • Went through the prompt builders and replaced all those repeated language conditionals with typed language maps instead.
  • Made sure the shared Turkish blocks for output formatting and auto-fix get reused in the single-agent prompt, so we don't end up with wording drifting apart later.
  • Removed the unreachable fallback case in the auto-review command description.
  • Swapped the getLang() casts for a type guard.

I kept the Chinese and English content as-is on purpose, and left the Custom Rules heading localization as something we could tackle separately if it makes sense.

Thanks again. If there's anything else that jumps out at you, I'm happy to dig into it.

@Svtter
Svtter merged commit 0256d2b into sun-praise:main Sep 16, 2026
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.

2 participants