Skip to content

Conversation

@Yukiniro
Copy link
Collaborator

@Yukiniro Yukiniro commented Dec 28, 2025

Type of Changes

  • ✨ New feature (feat)
  • πŸ› Bug fix (fix)
  • πŸ“ Documentation change (docs)
  • πŸ’„ UI/style change (style)
  • ♻️ Code refactoring (refactor)
  • ⚑ Performance improvement (perf)
  • βœ… Test related (test)
  • πŸ”§ Build or dependencies update (build)
  • πŸ”„ CI/CD related (ci)
  • 🌐 Internationalization (i18n)
  • 🧠 AI model related (ai)
  • πŸ”„ Revert a previous commit (revert)
  • πŸ“¦ Other changes that do not modify src or test files (chore)

Description

Related Issue

Closes #571

How Has This Been Tested?

  • Added unit tests
  • Verified through manual testing

Screenshots

Checklist

  • I have tested these changes locally
  • I have updated the documentation accordingly if necessary
  • My code follows the code style of this project
  • My changes do not break existing functionality
  • If my code was generated by AI, I have proofread and improved it as necessary.

Additional Information


Summary by cubic

Replaced franc-min with franc to expand language detection coverage in analysis and translation flows, and upgraded zod/ai to fix a type-check memory issue. Closes #571.

  • Dependencies
    • Updated: franc-min -> franc; zod -> 4.3.4; ai -> 6.0.6; @read-frog/definitions -> 0.0.7.
    • Updated imports in src/utils/content/analyze.ts and src/utils/host/translate/translate-text.ts.

Written for commit 5e7b3be. Summary will update on new commits.

@changeset-bot
Copy link

changeset-bot bot commented Dec 28, 2025

πŸ¦‹ Changeset detected

Latest commit: 5e7b3be

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@read-frog/extension Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Dec 28, 2025
@github-actions github-actions bot added the chore label Dec 28, 2025
@dosubot
Copy link

dosubot bot commented Dec 28, 2025

Related Documentation

Checked 14 published document(s) in 0 knowledge base(s). No updates required.

How did I do? Any feedback?Β Β Join Discord

@Yukiniro Yukiniro marked this pull request as draft December 28, 2025 12:39
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 5 files

@claude
Copy link

claude bot commented Dec 28, 2025

Code Review: Replace franc-min with franc

Summary

This PR replaces franc-min with franc to support more languages (specifically Hebrew per issue #571). The change is straightforward - swapping the package dependency and updating 2 import statements.


【Core Judgment】

βœ… Worth doing: Addresses a real user need (Hebrew language support) with minimal code change.

【Key Insights】

  • Data structure: No changes to data flow - just a library swap
  • Complexity: Zero added complexity - 1:1 replacement
  • Risk points: Bundle size increase (see below)

【Taste Score】

🟒 Good taste - Simple, focused change that solves the problem directly


Review Details

βœ… Positives

  1. Minimal, focused change - Only touches what's necessary (package.json, lockfile, 2 import statements)
  2. Direct solution - franc supports 400+ languages vs franc-min's ~80, solving the Hebrew detection issue
  3. No API changes - Both packages export the same franc function with identical interface
  4. Proper changeset - Includes a changeset for versioning

⚠️ Considerations

  1. Bundle Size Impact

    • franc includes language data for 400+ languages vs ~80 in franc-min
    • For a browser extension where bundle size matters, this is worth noting
    • However, given this is a language learning extension that benefits from broader language support, the tradeoff is reasonable
  2. No Tests for Language Detection

    • The codebase doesn't appear to have unit tests for the analyze.ts or translate-text.ts files that use franc
    • Manual testing (as checked in the PR) should be sufficient for this change since it's a drop-in replacement

πŸ” Code Quality

  • Clean import changes at:
    • src/utils/content/analyze.ts:5
    • src/utils/host/translate/translate-text.ts:7
  • No dead code or unnecessary changes
  • Follows existing code style

Verdict

Approve βœ…

This is a textbook example of a well-scoped change - it does exactly what's needed without over-engineering. The bundle size increase is an acceptable tradeoff for significantly expanded language detection capabilities in a language learning tool.

One optional suggestion for future consideration: If bundle size becomes a concern, the team could explore using franc with a custom language subset that includes all languages in LANG_CODE_TO_EN_NAME - but that's premature optimization for now.

@claude
Copy link

claude bot commented Jan 3, 2026

PR Review: Replace franc-min with franc

【Core Judgment】

βœ… Worth doing - This is a valid fix for issue #571. The user requested Hebrew language support which is not included in franc-min (82 languages) but is included in franc (187 languages).

【Code Quality】

🟒 Good taste - The change is minimal and focused.

Strengths:

  • Clean, surgical change - only touches what's necessary
  • Follows KISS principle: simplest solution to expand language coverage
  • No code logic changes, just a dependency swap
  • The franc API is identical to franc-min, so drop-in replacement works

【Key Observations】

1. Bundle Size Trade-off

  • franc-min: ~82 languages, smaller bundle (~2KB min+gzip)
  • franc: ~187 languages, larger bundle (~6KB min+gzip)

This is an acceptable trade-off for a browser extension where:

  • The extra ~4KB is negligible compared to total extension size
  • Users get significantly better language detection coverage
  • Hebrew and other requested languages become available

2. No Breaking Changes

  • Both packages export franc function with identical signature
  • ISO 639-3 codes are consistent between both packages
  • Existing detection logic in analyze.ts:68 and translate-text.ts:147 works unchanged

【Potential Concerns】

None critical. However, minor notes:

  1. No test coverage for language detection - The PR mentions "Verified through manual testing" which is appropriate for this change. The existing tests don't specifically test franc functionality, so no test updates are needed.

  2. Changeset is appropriate - Correctly marked as patch since this is a minor enhancement, not a breaking change.

【Recommendations】

  1. βœ… Approve as-is - The change is correct and solves the reported issue.

  2. Optional future improvement (not required for this PR): Consider adding a simple test that verifies Hebrew text is detected correctly, e.g.:

    expect(franc('Χ©ΧœΧ•Χ Χ’Χ•ΧœΧ')).toBe('heb')

Summary

This is a well-executed, minimal change that directly addresses user feedback. The approach follows the project's design principles (KISS, YAGNI, no over-engineering). The bundle size increase is justified by the expanded language support.

Verdict: Approve βœ…

@Yukiniro Yukiniro marked this pull request as ready for review January 3, 2026 06:42
@Yukiniro Yukiniro requested a review from mengxi-ream January 3, 2026 06:43
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 5 files

@claude
Copy link

claude bot commented Jan 3, 2026

PR Review: Replace franc-min with franc

Summary

This PR replaces franc-min with franc to support more languages for language detection, addressing issue #571 (Hebrew support request). The change is straightforward - it updates the dependency and import statements.

Code Quality βœ…

  • Clean implementation: The change is minimal and focused - only updating the import from franc-min to franc in two files.
  • No API changes: The franc function has the same API as franc-min, so no code changes are needed beyond the imports.
  • Proper changeset: Includes a changeset file for versioning.

Potential Considerations

1. Bundle Size Impact ⚠️

  • franc-min supports ~82 languages with smaller data files
  • franc supports ~400+ languages with larger trigram data files
  • This will increase the extension bundle size

Recommendation: Consider documenting the bundle size impact in the PR. For a browser extension, bundle size can affect:

  • Initial load time
  • Extension store review (some stores have size limits)
  • Memory usage

You might want to run a build comparison:

# Before (on main)
pnpm build && du -sh .output/

# After (on this branch)  
pnpm build && du -sh .output/

2. Test Coverage ⚠️

  • The PR mentions "Verified through manual testing" but no unit tests added
  • There are no existing tests for analyze.ts or translate-text.ts language detection

Recommendation: Consider adding a simple test to verify Hebrew detection works:

import { franc } from 'franc'

test('franc detects Hebrew', () => {
  const hebrewText = 'Χ©ΧœΧ•Χ Χ’Χ•ΧœΧ, Χ–Χ” טקבט Χ‘Χ’Χ‘Χ¨Χ™Χͺ ΧœΧ‘Χ“Χ™Χ§Χ”'
  expect(franc(hebrewText)).toBe('heb')
})

3. Related Definition Update βœ…

  • @read-frog/definitions bumped from 0.0.6 to 0.0.7
  • This likely includes Hebrew in the supported language codes - good coordination

Security βœ…

No security concerns - this is a simple dependency swap with no new attack vectors.

Performance βœ…

  • Language detection performance should be comparable
  • The larger trigram data will use slightly more memory at runtime

Verdict

🟒 Approve with minor suggestions

The PR correctly solves the issue with minimal changes. The only concerns are:

  1. Missing bundle size impact assessment
  2. No test coverage for the specific use case (Hebrew detection)

These are minor and shouldn't block the merge, but would be good to address for completeness.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 3, 2026
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jan 3, 2026
@claude
Copy link

claude bot commented Jan 3, 2026

PR Review: Replace franc-min with franc for language detection

Summary

This PR replaces franc-min with franc to support more languages (addressing issue #571 requesting Hebrew support), and also upgrades zod, ai, and various AI SDK packages to fix a type-check memory issue.


【Taste Score】

🟒 Good taste - The changes are minimal, focused, and solve a real user problem.


【Core Judgment】

βœ… Worth doing

  • Real problem: Users can't select Hebrew (and other languages) for auto-translate because franc-min only supports ~82 languages vs franc's 406 languages.
  • Simple solution: Just swap the package and update 2 import statements.
  • Low risk: The API is identical between franc-min and franc.

Code Quality βœ…

The source code changes are clean and minimal:

  1. src/utils/content/analyze.ts:5 - Import change from franc-min to franc
  2. src/utils/host/translate/translate-text.ts:7 - Import change from franc-min to franc

Both files use franc identically - just calling franc(text) to detect language. The API is the same between both packages.


Potential Concerns

1. Bundle Size Impact ⚠️

franc is larger than franc-min:

  • franc-min: ~82 languages, smaller bundle (~200KB)
  • franc: 406 languages, larger bundle (~2MB uncompressed)

Recommendation: For a browser extension, bundle size matters. Consider if this increase is acceptable. However, since this is a language learning extension, supporting more languages is a core feature, so the tradeoff is likely justified.

2. Mixed PR Scope πŸ“

This PR combines two unrelated changes:

  1. Replacing franc-min with franc (feature)
  2. Upgrading zod and ai packages to fix type-check memory issues (bugfix)

These should ideally be separate PRs for cleaner git history and easier rollback if needed. However, this is minor and both changes seem stable.

3. Major Version Bumps in Dependencies

  • @ai-sdk/amazon-bedrock: 3.x β†’ 4.x (major version bump)
  • ollama-ai-provider-v2: 1.x β†’ 2.x (major version bump)

Question: Have breaking changes been checked for these major version updates?


Testing πŸ§ͺ

The PR indicates manual testing was done. Some suggestions:

  • Verify Hebrew language detection works as expected
  • Test that existing language detection for common languages (English, Chinese, Japanese, etc.) still works correctly
  • Verify the extension popup/options load without performance degradation from the larger bundle

Security βœ…

No security concerns. The changes only affect language detection logic and dependency versions.


Recommendations

  1. Accept with minor concerns - The core change is sound and solves a real user problem.
  2. Consider documenting the bundle size tradeoff in the PR description for future reference.
  3. Ensure the major version bumps in AI SDK packages don't introduce regressions.

Verdict

Approve - The changes are well-scoped, the code modifications are minimal and correct, and this addresses a legitimate user feature request. The bundle size increase is an acceptable tradeoff for a language learning extension that needs broad language support.

🐸 Reviewed by Claude Code

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid β€” if so, understand the root cause of each and fix them.


<file name=".changeset/quick-ties-attack.md">

<violation number="1" location=".changeset/quick-ties-attack.md:5">
P2: Changeset description doesn&#39;t match the PR&#39;s actual changes. The PR replaces `franc-min` with `franc` to support more languages, but the changeset message describes upgrading zod and ai packages for memory issues. This will generate an incorrect changelog entry.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

"@read-frog/extension": patch
---

fix: upgrade zod and ai packages to solve memory issue of type check
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 3, 2026

Choose a reason for hiding this comment

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

P2: Changeset description doesn't match the PR's actual changes. The PR replaces franc-min with franc to support more languages, but the changeset message describes upgrading zod and ai packages for memory issues. This will generate an incorrect changelog entry.

Prompt for AI agents
Check if this issue is valid β€” if so, understand the root cause and fix it. At .changeset/quick-ties-attack.md, line 5:

<comment>Changeset description doesn&#39;t match the PR&#39;s actual changes. The PR replaces `franc-min` with `franc` to support more languages, but the changeset message describes upgrading zod and ai packages for memory issues. This will generate an incorrect changelog entry.</comment>

<file context>
@@ -0,0 +1,5 @@
+&quot;@read-frog/extension&quot;: patch
+---
+
+fix: upgrade zod and ai packages to solve memory issue of type check
</file context>
Fix with Cubic

@mengxi-ream mengxi-ream merged commit ce49281 into main Jan 3, 2026
8 checks passed
@mengxi-ream mengxi-ream deleted the 7kz0sjfk branch January 3, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Auto translate based on language : More Language

4 participants