Skip to content

feat(subtitles): add translation blur reveal option - #1448

Open
oskkas wants to merge 1 commit into
mengxi-ream:mainfrom
oskkas:feat/subtitle-translation-blur
Open

feat(subtitles): add translation blur reveal option#1448
oskkas wants to merge 1 commit into
mengxi-ream:mainfrom
oskkas:feat/subtitle-translation-blur

Conversation

@oskkas

@oskkas oskkas commented May 4, 2026

Copy link
Copy Markdown
Contributor

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

Adds an optional blur effect for translated video subtitles. When enabled, translated subtitle text is blurred by default, reveals on hover, and becomes blurred again when the subtitle changes.

This is useful because it keeps the focus on the original language, revealing the translation only when specifically needed. This also adds the setting to both subtitle style UIs, places it under Translation Subtitles, adds localized labels, and includes a config migration for existing users.

Related Issue

Closes #

How Has This Been Tested?

  • Added unit tests
  • Verified through manual testing

Screenshots

image



image



image

Checklist

  • I have tested these changes locally
  • I have updated the documentation accordingly if necessary
  • My code follows the coding 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

Includes a changeset for @read-frog/extension.

@changeset-bot

changeset-bot Bot commented May 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c9794d1

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

@github-actions github-actions Bot added feat contrib-trust:new PR author trust score is 0-29. needs-maintainer-review Contributor trust automation recommends maintainer review. labels May 4, 2026
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Contributor trust score

20/100 — New contributor

This score estimates contributor familiarity with mengxi-ream/read-frog using public GitHub signals. It is advisory only and does not block merges automatically.

Outcome

Score breakdown

Dimension Score Signals
Repo familiarity 11/35 commits in repo, merged PRs, reviews
Community standing 5/25 account age, followers, repo role
OSS influence 0/20 stars on owned non-fork repositories
PR track record 4/20 merge rate across resolved PRs in this repo

Signals used

  • Repo commits: 1 (author commits reachable from the repository default branch)
  • Repo PR history: merged 1, open 1, closed-unmerged 0
  • Repo reviews: 0
  • PR changed lines: 343 (+310 / -33)
  • Repo permission: read
  • Followers: 0
  • Account age: 42 months
  • Owned non-fork repos considered: max 0, total 0 (oskkas/sia-notification-system (0), oskkas/config-server-repo (0), oskkas/microservices-management (0), oskkas/oskkas (0))

Policy

  • Low-score review threshold: < 30
  • Auto-close: score < 20 and changed lines > 1000
  • Policy version: v1.1

Updated automatically when the PR changes or when a maintainer reruns the workflow.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c36fe5c25

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/entrypoints/subtitles.content/ui/subtitle-lines.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 38c4c49b32

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/entrypoints/subtitles.content/ui/subtitle-lines.tsx Outdated
@oskkas
oskkas marked this pull request as draft May 4, 2026 04:15
@oskkas
oskkas force-pushed the feat/subtitle-translation-blur branch 4 times, most recently from 0432c22 to 8eea6b3 Compare May 4, 2026 07:32
@oskkas
oskkas marked this pull request as ready for review May 4, 2026 07:40
@mengxi-ream

Copy link
Copy Markdown
Owner

@taiiiyang do you think we should add this feature now?

Includes state corrections when toggles are changed, refactoring of imports, and corresponding tests.
@oskkas
oskkas force-pushed the feat/subtitle-translation-blur branch from 7cbc453 to c9794d1 Compare May 15, 2026 07:10
@taiiiyang

Copy link
Copy Markdown
Collaborator

Maybe we can make it work like the translation display style, supporting multiple types of styles. Instead of using a single toggle, we can implement it in the form of a selector, like this:

image

Blur is just one of the options.

@taiiiyang taiiiyang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for your contribution!
We would like to extend this blur feature into a general subtitle preset style system (similar to translationNodeStyle.preset in web translation), so the data structure and implementation approach need to be adjusted.

const resetSubtitlesStyleConfig = () => {
void setVideoSubtitlesConfig(deepmerge(videoSubtitlesConfig, {
style: {
blurTranslation: DEFAULT_BLUR_TRANSLATION,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would prefer to design it this way for future scalability.
Refer to the current configuration writing style of the preset styles for translation.

// src/types/config/subtitles.ts
 export const subtitleStylePresetSchema = z.enum(SUBTITLE_STYLE_PRESET)
 export type SubtitleStylePreset = z.infer<typeof subtitleStylePresetSchema>

 export const subtitleTextStyleSchema = z.object({
   preset: subtitleStylePresetSchema,  // new
   fontFamily: subtitlesFontFamilySchema,
   fontScale: z.number().min(MIN_FONT_SCALE).max(MAX_FONT_SCALE),
   color: z.string(),
   fontWeight: z.number().min(MIN_FONT_WEIGHT).max(MAX_FONT_WEIGHT),
 })

 // src/utils/constants/subtitles.ts
 export const SUBTITLE_STYLE_PRESET = [
   "default", "blur"
 ] as const

 export const DEFAULT_SUBTITLE_STYLE_PRESET = "default" as const

Comment on lines +57 to +62
const [revealedForText, setRevealedForText] = useState(false)
const blurStyle = blurTranslation && !revealedForText
? { filter: TRANSLATION_BLUR_FILTER, opacity: 0.75, transition: "none" }
: blurTranslation
? { filter: "blur(0)", opacity: 1, transition: "filter 0.15s ease-in-out, opacity 0.15s ease-in-out" }
: undefined

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This logic is too tightly coupled and can be refactored as follows.

  import { cva } from "class-variance-authority"

  export const subtitlePresetVariants = cva("", {
    variants: {
      preset: {
        default: "",
        blur: "blur-[0.25em] opacity-75 hover:blur-[0px] hover:opacity-100 transition-all duration-150",
      },
    },
    defaultVariants: {
      preset: "default",
    },
  })

export function TranslationSubtitle({ content, className }: SubtitleLineProps) {
    const subtitle = useAtomValue(currentSubtitleAtom)
    const { style } = useAtomValue(configFieldsAtomMap.videoSubtitles)
    const language = useAtomValue(configFieldsAtomMap.language)
    const text = content ?? subtitle?.translation ?? ""
    const { dir, lang } = getLanguageDirectionAndLang(language.targetCode)

    return (
      <div
        className={cn("subtitles-translation leading-tight text-xl", subtitlePresetVariants({ preset:
  style.translation.preset }), className)}
        style={getTextStyles(style.translation)}
        dir={dir}
        lang={lang}
      >
        {text}
      </div>
    )

@BilderLoong

Copy link
Copy Markdown

@iuhoay @mengxi-ream @taiiiyang Hello, please take a look at #1554. How do you guys think about it?

Prototype

I already made a prototype, as in #1558.
The main logic is in: https://github.com/mengxi-ream/read-frog/pull/1558/changes#diff-f6fb808bfa6d2644209357b84a0a1f5d8f8097bcad05a675467a7ec891e31455R19-R70

@mengxi-ream

Copy link
Copy Markdown
Owner

@iuhoay @mengxi-ream @taiiiyang Hello, please take a look at #1554. How do you guys think about it?

Prototype

I already made a prototype, as in #1558. The main logic is in: #1558 (changes)

I think @oskkas 's implementation is better, but may also follow @taiiiyang 's reviews

@mengxi-ream

Copy link
Copy Markdown
Owner

@iuhoay @mengxi-ream @taiiiyang Hello, please take a look at #1554. How do you guys think about it?

Prototype

I already made a prototype, as in #1558. The main logic is in: #1558 (changes)

I think @oskkas 's implementation is better, but may also follow @taiiiyang 's reviews

To clarify, I think use keyboard to toggle blur effect is good. but this PR need to be merged first and we built the feature on the top of this PR.

@oskkas

oskkas commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for your contribution! We would like to extend this blur feature into a general subtitle preset style system (similar to translationNodeStyle.preset in web translation), so the data structure and implementation approach need to be adjusted.

Thanks. Just to confirm the direction. Are you suggesting replacing the current toggle entirely with a preset selector inside the Translation Subtitles section (where "blur" is one of the options), or should the toggle stay as a quick access control alongside it?

Also, regarding the refactor to pure CSS hover via cva moving away from the stateful approach revealedForText changes a core behavior, with pure CSS :hover, if the user leaves their mouse parked over the subtitle area, the next subtitle cue will appear already revealed. The original React state logic ensured that the blur resets every time the subtitle text changes, even if the mouse hasn't moved. Is losing this reset behavior acceptable for the new preset system, or should we combine the cva preset with the React state to keep the original UX?

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

This PR has been inactive for 14 days and is now marked as stale.
It will be automatically closed in 30 days if no further activity occurs.

@github-actions github-actions Bot added the Stale label Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contrib-trust:new PR author trust score is 0-29. feat needs-maintainer-review Contributor trust automation recommends maintainer review. on-hold Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants