Skip to content

Add Turkish target language and fix macOS whisper runtime#32

Merged
Blue-B merged 2 commits into
Blue-B:mainfrom
AtillaTahak:tr-target-pr
Jul 13, 2026
Merged

Add Turkish target language and fix macOS whisper runtime#32
Blue-B merged 2 commits into
Blue-B:mainfrom
AtillaTahak:tr-target-pr

Conversation

@AtillaTahak

@AtillaTahak AtillaTahak commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Adds Turkish as a selectable translation target and fixes macOS whisper runtime packaging so libwhisper/libggml dylibs are copied correctly.

Summary by CodeRabbit

  • New Features
    • Added Turkish (tr) as a selectable target language, including consistent display labels across the UI.
    • Turkish language names are now shown correctly in supported interface locales.
  • Bug Fixes
    • Improved detection of incomplete Whisper runtime installations and better handling of missing shared libraries (including clearer macOS guidance).
    • Enhanced validation during post-install and improved error reporting for invalid translation context-aware JSON responses.
  • Tests
    • Updated smoke and e2e checks to cover Turkish language selection behavior.
  • Documentation
    • Updated language support documentation across multiple readmes to include Turkish.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 81b0f7cb-b4fa-40f6-8ed4-a63125c581a0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The change adds Turkish as a translation target across the UI, localized mappings, documentation, and smoke tests. It also validates whisper-cpp runtime libraries during installation, improves macOS missing-library diagnostics, hardens archive extraction, and reports invalid translation JSON with a descriptive error.

Changes

Turkish language support

Layer / File(s) Summary
Add Turkish target language
README.md, docs/README.*.md, index.html, renderer.js, translator-enhanced.js, scripts/e2e-smoke.js, scripts/smoke-test.js
Adds tr to documented targets, the target selector, localized names, translation mappings, and UI validation coverage.

Whisper runtime handling

Layer / File(s) Summary
Validate whisper runtime installation
scripts/postinstall.js, scripts/smoke-test.js
Adds runtime probing, verifies installations and source builds, searches build/bin, hardens archive extraction, and tests the exported probe.
Diagnose missing macOS libraries
main.js
Buffers subprocess stderr, detects dyld/shared-library failures, provides macOS recovery guidance, and renames unused IPC parameters.

Translation response validation

Layer / File(s) Summary
Validate context-aware responses
translator-enhanced.js, scripts/smoke-test.js
Wraps invalid JSON parse failures with a descriptive error and preserves the original cause; smoke tests cover the behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: adding Turkish language support and fixing macOS Whisper runtime handling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@main.js`:
- Around line 2152-2159: Update the looksLikeDyldMissingLib detector to require
a genuine macOS loader signature: retain the explicit “dyld: library not loaded”
check, and only accept “image not found” when the stderr also references a
dylib. Remove the broad standalone “no such file” and “.dylib” conditions while
preserving the process.platform === 'darwin' guard.

In `@scripts/postinstall.js`:
- Around line 30-40: Update hasWhisperRuntimeLibraries to require the Windows
runtime DLL dependencies in addition to whisper-cli.exe before returning true.
Validate the selected build’s required whisper.dll and ggml*.dll files, and when
the cpu/ fallback directory exists, validate the corresponding DLL set there as
well; return false if any required dependency is missing.
- Around line 484-492: Update the post-install success path in main() to re-run
hasWhisperRuntimeLibraries() before every successful return, rather than
validating only WHISPER_CLI. If the runtime libraries are still missing after
installation or extraction, report the installation as incomplete and avoid
logging success; retain the existing successful return only when the
completeness predicate passes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9a322648-e122-4596-a800-6810b128553e

📥 Commits

Reviewing files that changed from the base of the PR and between f4a4c8b and 7b88e48.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json, !package-lock.json
📒 Files selected for processing (5)
  • README.md
  • index.html
  • main.js
  • renderer.js
  • scripts/postinstall.js

Comment thread main.js Outdated
Comment thread scripts/postinstall.js Outdated
Comment thread scripts/postinstall.js
Validate the installed whisper runtime by launching the CLI, narrow macOS dyld detection, complete Turkish provider and documentation coverage, and credit the contributor across localized READMEs.

@Blue-B Blue-B left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified locally: the full check and Electron E2E pass, the packaged Linux runtime launches and completes a real extraction, and the macOS dylib packaging layout was inspected. Follow-up review fixes and contributor attribution are included. Ready to merge.

@Blue-B
Blue-B self-requested a review July 13, 2026 07:02
@Blue-B

Blue-B commented Jul 13, 2026

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Blue-B
Blue-B removed their request for review July 13, 2026 07:10
@Blue-B
Blue-B merged commit cb47724 into Blue-B:main Jul 13, 2026
3 of 4 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/postinstall.js (1)

662-731: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Run the runtime probe on the CPU fallback before reporting success.
The fallback copy step can still leave whisper-cli.exe unusable if a DLL is missing or incompatible, but this path currently logs success unconditionally. Reuse hasWhisperRuntimeLibraries(CPU_CLI, CPU_DIR) here and warn if the CPU bundle can’t load.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/postinstall.js` around lines 662 - 731, The CPU fallback installation
in the download flow reports success without validating the copied executable
and libraries. After copying files in the CPU fallback block, call
hasWhisperRuntimeLibraries with CPU_CLI and CPU_DIR; only report the bundle as
successfully installed when it passes, otherwise emit a warning that the CPU
fallback cannot load.
🧹 Nitpick comments (2)
scripts/smoke-test.js (1)

110-113: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert that the original parse error is preserved.

This test only checks the new message prefix, so it would pass even if { cause: error } were removed. Also assert that the thrown error’s cause is the original SyntaxError.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/smoke-test.js` around lines 110 - 113, Update the
parseContextAwareJson assertion in the smoke test to capture the thrown error
and verify its cause is the original SyntaxError, while retaining the existing
message-prefix check.
scripts/postinstall.js (1)

192-210: 🔒 Security & Privacy | 🔵 Trivial | ⚖️ Poor tradeoff

Good use of execFileSync argument arrays — but no checksum verification before extraction.

Switching to execFileSync with explicit argument arrays (instead of a shell string) is exactly right and avoids shell-injection risk for tar/unzip/PowerShell.

However, the archives downloaded from GitHub releases are extracted here with no hash/checksum verification against the fetched release metadata. Since this pipeline downloads and then executes third-party binaries, verifying a published checksum (or at minimum pinning/validating asset digests) before extraction would meaningfully harden the install chain.

As per path instructions for scripts/**: "Watch for unpinned downloads, missing checksum verification, and shell injection in spawn/exec calls."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/postinstall.js` around lines 192 - 210, Update the
download-and-extract flow used by extractZip to verify each GitHub release
archive against its published checksum or validated asset digest before any
extraction occurs. Reuse the fetched release metadata and existing archive path
handling, reject missing or mismatched verification data with a clear error, and
only invoke the tar, PowerShell, or unzip branches after validation succeeds.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/smoke-test.js`:
- Around line 79-87: Update runWhisperRuntimeProbe to invoke a real whisper-cli
binary rather than process.execPath, using an available test fixture or resolved
installed executable and its containing runtime directory. Keep the missing-cli
assertion, and ensure the positive assertion exercises the binary so
hasWhisperRuntimeLibraries validates actual Whisper runtime loading.

---

Outside diff comments:
In `@scripts/postinstall.js`:
- Around line 662-731: The CPU fallback installation in the download flow
reports success without validating the copied executable and libraries. After
copying files in the CPU fallback block, call hasWhisperRuntimeLibraries with
CPU_CLI and CPU_DIR; only report the bundle as successfully installed when it
passes, otherwise emit a warning that the CPU fallback cannot load.

---

Nitpick comments:
In `@scripts/postinstall.js`:
- Around line 192-210: Update the download-and-extract flow used by extractZip
to verify each GitHub release archive against its published checksum or
validated asset digest before any extraction occurs. Reuse the fetched release
metadata and existing archive path handling, reject missing or mismatched
verification data with a clear error, and only invoke the tar, PowerShell, or
unzip branches after validation succeeds.

In `@scripts/smoke-test.js`:
- Around line 110-113: Update the parseContextAwareJson assertion in the smoke
test to capture the thrown error and verify its cause is the original
SyntaxError, while retaining the existing message-prefix check.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c03c0a4b-e935-476a-9bd6-227992c7b466

📥 Commits

Reviewing files that changed from the base of the PR and between 7b88e48 and ee069ba.

📒 Files selected for processing (10)
  • README.md
  • docs/README.ja.md
  • docs/README.ko.md
  • docs/README.pl.md
  • docs/README.zh.md
  • main.js
  • scripts/e2e-smoke.js
  • scripts/postinstall.js
  • scripts/smoke-test.js
  • translator-enhanced.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • main.js

Comment thread scripts/smoke-test.js
Comment on lines +79 to +87
function runWhisperRuntimeProbe() {
const runtimeDir = fs.mkdtempSync(path.join(os.tmpdir(), 'wst-runtime-probe-'));
try {
assert.strictEqual(hasWhisperRuntimeLibraries(path.join(runtimeDir, 'missing-cli'), runtimeDir), false);
assert.strictEqual(hasWhisperRuntimeLibraries(process.execPath, path.dirname(process.execPath)), true);
} finally {
fs.rmSync(runtimeDir, { recursive: true, force: true });
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the file structure relevant to the smoke test
git ls-files scripts/smoke-test.js
wc -l scripts/smoke-test.js

# Show the relevant sections with line numbers
sed -n '1,220p' scripts/smoke-test.js

Repository: Blue-B/WhisperSubTranslate

Length of output: 5801


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find the helper and any related tests/usages
rg -n "hasWhisperRuntimeLibraries|runWhisperRuntimeProbe|whisper-cli|libwhisper|libggml" scripts/smoke-test.js .

Repository: Blue-B/WhisperSubTranslate

Length of output: 7818


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the runtime-library probe helper and nearby logic
sed -n '1,120p' scripts/postinstall.js
printf '\n---\n'
sed -n '120,220p' scripts/postinstall.js
printf '\n---\n'
sed -n '220,420p' scripts/postinstall.js

Repository: Blue-B/WhisperSubTranslate

Length of output: 13679


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect any smoke-test documentation or comments that describe the intended probe
rg -n "runWhisperRuntimeProbe|hasWhisperRuntimeLibraries|Smoke tests passed|whisper runtime" scripts docs README.md main.js package.json

Repository: Blue-B/WhisperSubTranslate

Length of output: 1092


Probe a real whisper-cli binary here. process.execPath only runs Node/Electron --help, so this check can pass without loading Whisper’s runtime libraries and doesn’t validate the installed runtime.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/smoke-test.js` around lines 79 - 87, Update runWhisperRuntimeProbe to
invoke a real whisper-cli binary rather than process.execPath, using an
available test fixture or resolved installed executable and its containing
runtime directory. Keep the missing-cli assertion, and ensure the positive
assertion exercises the binary so hasWhisperRuntimeLibraries validates actual
Whisper runtime loading.

@Blue-B

Blue-B commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Thank you, @AtillaTahak, for this contribution. Turkish translation support and the macOS runtime fix are now merged, and I have added you to the Contributors section. I appreciate the careful cross-platform work!

@AtillaTahak

Copy link
Copy Markdown
Contributor Author

Thank you, @AtillaTahak, for this contribution. Turkish translation support and the macOS runtime fix are now merged, and I have added you to the Contributors section. I appreciate the careful cross-platform work!

Thank you so much for the review and for merging the PR! I'm glad I could contribute to the project.

I really appreciate being added to the Contributors section as well. Looking forward to contributing more in the future. 🚀

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