🧼 A popup translation tool.

Overview

Popup translation

通过 wry 打开一个 webview 窗口,然后打开某个翻译平台的网页翻译内容,并通过 js 代码屏蔽掉不需要的内容,专注于翻译内容本身。

img.png

💫 Features

  1. 利用 wry 提供的网页视图功能实现的弹窗功能
  2. 从剪贴板读取文本并翻译
    • Linux(x11) 下支持所选文本的翻译,即不需要复制到剪贴板(尚不支持**MacOS **) #3
    • Windows 模拟一次 ctrl+c 后,在读取剪贴板的内容
  3. 从命令行传入文本进行翻译
  4. 支持多种翻译平台
    1. Bing
    2. Youdao
    3. YouGlish
    4. Dict
    5. openai fanyi -p ai --key=xxx hello
    6. Google

🚀 Getting Started

cargo install --git https://github.com/fzdwx/popup-translation

# 命令行直接设置翻译文本,只运行一次
fanyi hello
fanyi -p youdao 你好

# 守护模式,可以一直翻译,`ctrl+shift+c` 打开窗口
fanyi

# 覆盖快捷键,使用 `alt+s` 打开窗口
fanyi --show=alt+s

# 设置窗口显示位置,默认为鼠标附近
fanyi --position=100,100

fanyi --help

🕹️ Integrated

nvim

map("n", "<leader>fy", function()
    local word = vim.fn.expand("<cWORD>")
    local cmd = { "fanyi", word }
    vim.fn.jobstart(cmd, { detach = true })
end, { desc = "qwe" })

gif

🦹 TODO

  • 弹窗位置选项(当前是固定获取鼠标附近)
    • --Position=top-left, top-center , top-right, bottom-left, bottom-center , bottom-right, center
    • --Position=tl, tc, tr, bl, bc, br, c
  • 热键
    • open
      • 从粘贴板读取数据
      • 读取鼠标选择的数据
        • Linux
        • Windows
        • MacOS
    • close
  • 全程只使用一个 webview

📖 Thanks

  1. manateelazycat - popweb
  2. wry

License

MIT

You might also like...
Rusty Armor Builds - Monster Hunter Rise Armor Set Creation Tool
Rusty Armor Builds - Monster Hunter Rise Armor Set Creation Tool

RAB Rusty Armor Builds - Monster Hunter Rise Armor Set Creation Tool Armor files used by RAB

BSP 19&20&21 Review tool

BSP review tool Limitations PAKFILE&ENTITIES lumps can't be bigger than the original ToDo WASM - needs file action interops Proper serialisation - rig

Minimal viable ZFS autosnapshot tool

zfs-autosnap Minimal viable ZFS snapshot utility. Add zfs-autosnap snap to your cron.hourly, and zfs-autosnap gc to cron.daily; then set at.rollc.at:s

A lite tool to make systemd work in any container(Windows Subsystem for Linux 2, Docker, Podman, etc.)

Angea Naming from hydrangea(アジサイ) A lite tool to make systemd work in any container(Windows Subsystem for Linux 2, Docker, Podman, etc.) WSL1 is not s

A tool to run web applications on AWS Lambda without changing code.
A tool to run web applications on AWS Lambda without changing code.

AWS Lambda Adapter A tool to run web applications on AWS Lambda without changing code. How does it work? AWS Lambda Adapter supports AWS Lambda functi

tar analysis tool

alquitran Inspects tar archives and tries to spot portability issues in regard to POSIX 2017 pax specification and common tar implementations. Usage R

Incremental, multi-version remote backup tool for block devices.

bsync Incremental, multi-version remote backup tool for block devices. The on-disk backup format is a SQLite database and I've been dogfooding this on

Keyscope is a key and secret workflow (validation, invalidation, etc.) tool built in Rust
Keyscope is a key and secret workflow (validation, invalidation, etc.) tool built in Rust

✅ Automate your key and secret validation workflows 🤠 Over 30 different providers 🤖 Export to JSON, audit via CSV 🔑 Keyscope Keyscope is a key and

A tool to subscribe to Twitch channels and store them efficiently on disk

twitch-messages A tool to subscribe to Twitch channels and store them efficiently on disk Build the Tools You can start by building the binaries that

Comments
  • 实现更多的 API 类型的翻译器,比如 deepl,baidu,youdao等

    实现更多的 API 类型的翻译器,比如 deepl,baidu,youdao等

    目前实现了通过 openai 的 api 来进行翻译, 同理也可以其他平台的:

    • [x] google -https://github.com/fzdwx/popup-translation/blob/main/src/translation/todo_google.md
    • [ ] deepl - https://github.com/fzdwx/popup-translation/blob/main/src/translation/todo_deepl.md
    enhancement good first issue 
    opened by fzdwx 0
  • 支持选择文本后通过快捷键进行翻译

    支持选择文本后通过快捷键进行翻译

    • [x] 1.Windows - 目前是唤起窗口后,模拟了一次 ctrl+c 的操作(by @Chanyon) 如果有个更好的方案欢迎 PR - #4
    • [ ] 2.Macos
    • [x] 3.Linux - x11

    Originally posted by @Chanyon in https://github.com/fzdwx/popup-translation/issues/2#issuecomment-1427359668

    enhancement good first issue 
    opened by fzdwx 0
Releases(v0.3.1)
  • v0.3.1(Feb 21, 2023)

    Support google api translation https://github.com/fzdwx/popup-translation/blob/main/src/translation/google_api.rs#L67

    command: fanyi -p google hello

    image

    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Feb 19, 2023)

    v0.3.0

    1. Support openai translation fanyi -p=ai -k=xxx hello, the key is required
      • https://github.com/fzdwx/popup-translation/blob/main/src/translation/ai_gpt.rs#L47 is current prompt, if you have a better one, PR is welcome
    2. Refactor translation, add Api and Url type
    3. Fix position bug (center position is not correct)

    open ai: image

    Source code(tar.gz)
    Source code(zip)
  • v0.2.4(Feb 18, 2023)

    v0.2.4 2023/02/18

    1. Add more Position options PresetPosition
      • --Position=top-left, top-center , top-right, bottom-left, bottom-center , bottom-right, center
      • --Position=tl, tc, tr, bl, bc, br, c
    2. Pin x11-clipboard under linux
    Source code(tar.gz)
    Source code(zip)
  • v0.2.3(Feb 15, 2023)

  • v0.2.2(Feb 14, 2023)

    feat:

    1. Support read from selection Windows(Simulate 'ctrl c' once before reading the contents of the clipboard) https://github.com/fzdwx/popup-translation/pull/4 @Chanyon
    2. Support for setting the window display position fanyi --position=100,100

    https://crates.io/crates/popup-translation

    Source code(tar.gz)
    Source code(zip)
  • v0.2.1(Feb 13, 2023)

Owner
Li Ke
Li Ke
🏪 Modern emoji picker popup for desktop, based on Emoji Mart, built with Tauri and Svelte

Emoji Mart desktop popup Modern emoji picker popup app for desktop, based on the amazing Emoji Mart web component. ?? Built as a popup: quick invocati

Vincent Emonet 10 Jul 3, 2023
Forked rust translation of the popular dump1090 project for adsb demodulation

Forked rust translation of the popular dump1090 project for adsb demodulation

wcampbell 64 Dec 24, 2022
Smolprng - A small PRNG library written in Rust, a translation of SmallPRNG

SmolPRNG This is a small PRNG library/framwork written in pure Rust, that is a translation of another project of mine, SmallPRNG. The main goal of thi

Dustin Kenefake 2 Jan 10, 2022
A tool of generating and viewing dice roll success distributions.

AZDice A GUI tool for generating and visualising dice roll probability distributions. Aims Intended to help people trying to get game balance just rig

null 13 Mar 2, 2021
Simple tool for scaffolding

quick-skeleton tldr; Lightweight replacement for yeoman or slush. Powered by handlebars. This is a scaffolding tool to save you hours of writing boile

Arthur 23 Apr 21, 2022
A nifty commandline tool to manage your workstation.

workstation It's a nifty commandline rust tool to make you sit slightly away from your screen by blacking out the screen if you come too close and loc

Amar Lakshya (desi_tux) 16 May 6, 2022
A command-line tool collection to assist development written in RUST

dtool dtool is a command-line tool collection to assist development Table of Contents Description Usage Tips Installation Description Now dtool suppor

GB 314 Dec 18, 2022
A low-ish level tool for easily writing and hosting WASM based plugins.

A low-ish level tool for easily writing and hosting WASM based plugins. The goal of wasm_plugin is to make communicating across the host-plugin bounda

Alec Deason 62 Sep 20, 2022
A cross platform tool which instantly notifies about COVID vaccine availability.

?? CoWIN Notifier ?? A cross-platform tool written in rust, which instantly notifies users about COVID-19 vaccine availability at their regions. Curre

Sanskar Jaiswal 20 May 20, 2021
A small tool to clone git repositories to a standard location, organised by domain name and path.

A small tool to clone git repositories to a standard location, organised by domain name and path. Runs on BSD, Linux, macOS, Windows, and more.

Wesley Moore 68 Dec 19, 2022