An open API service indexing awesome lists of open source software.

https://github.com/ilyhalight/voice-over-translation

Небольшое расширение, которое добавляет закадровый перевод видео из YaBrowser в другие браузеры
https://github.com/ilyhalight/voice-over-translation

extension userscript vot vtrans

Last synced: about 1 month ago
JSON representation

Небольшое расширение, которое добавляет закадровый перевод видео из YaBrowser в другие браузеры

Awesome Lists containing this project

README

        

# Voice-over-translation

[![ru](https://img.shields.io/badge/%D1%8F%D0%B7%D1%8B%D0%BA-%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9%20%F0%9F%87%B7%F0%9F%87%BA-white)](README.md)
[![en](https://img.shields.io/badge/lang-English%20%F0%9F%87%AC%F0%9F%87%A7-white)](README-EN.md)

> [!CAUTION]
> Before creating Issues, we strongly recommend that you read the [FAQ](https://github.com/ilyhalight/voice-over-translation/wiki/%5BEN%5D-FAQ) section, as well as with existing [Issues](https://github.com/ilyhalight/voice-over-translation/issues)

> [!WARNING]
> All rights to the original software belong to their respective right holders. The extension isn't affiliated with the original rights holders

The voice-over translation of the video is now available not only in YandexBrowser. Very grateful, **[Yandex.Translate](https://translate.yandex.ru/)**, **[mynovelhost](https://github.com/mynovelhost)**, **[SashaXser](https://github.com/SashaXser)** and to all other contributors. Thanks <3

## Installing the extension:

> [!WARNING]
> If you use Tampermonkey 5.2.0+, don't forget to [enable](https://github.com/ilyhalight/voice-over-translation/issues/662#issuecomment-2160768958) Developer mode or use Tampermonkey MV2

1. Install the extension **[Tampermonkey](https://www.tampermonkey.net/)** (An alternative for Safari: **[UserScripts](https://apps.apple.com/app/userscripts/id1463298887)**)
2. **[«Install the Script»](https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js)**

## List of functionality:

1. Video translation from [one of the available languages](LANG_SUPPORT.md) in russian, english or kazakh
2. Translation of streams to YouTube (works with a slight delay)
3. Displaying subtitles generated by the neural network
4. Displaying subtitles from the site (YouTube additionally displays subtitles that are automatically translated by the site into the selected language)
5. Saving used subtitles (supported formats: `.srt`, `.vtt`, `.json`)
6. Saving the audio track of the translation (in `.mp3` format)
7. Automatic video translation when opening
8. Sliders for changing video volume and translation
9. Automatic setting of the translated video volume (as in Yandex browser)
10. Synchronizing the translation volume with the video volume
11. Limiting the translation of videos from your native language (you can select the language in the menu)
12. Translation with hotkey
13. Setting up the design of subtitles
14. Showing translation for separated words in subtitles

### Useful links:

1. Javascript library (vot.js): **[Link](https://github.com/FOSWLY/vot.js)**
2. Terminal version (vot-cli): **[Link](https://github.com/FOSWLY/vot-cli)**
3. Wiki: **[Link](https://github.com/ilyhalight/voice-over-translation/wiki)**

## Note:

1. I recommend allowing autoplay of "audio and video" to avoid errors when working with the extension
2. The extension cannot translate videos longer than 4 hours (translator API limitation)

## List of supported sites:

You can see the full list of supported websites and all restrictions related to their support in **[wiki](https://github.com/ilyhalight/voice-over-translation/wiki/%5BEN%5D-Supported-sites)**

### Our domains:

These domains can be set in the extension settings (only those domains that can be changed without rebuilding are listed here):

#### Proxy-server

It's necessary for proxying requests if it is not possible to make a direct request to the Yandex servers

- [vot-worker.toil.cc](https://vot-worker.toil.cc/health) (Load balancer between proxy servers)
- [vot-worker-s1.toil.cc](https://github.com/FOSWLY/vot-worker)
- [vot-worker-s2.toil.cc](https://github.com/FOSWLY/vot-worker)
- [vot.deno.dev](https://github.com/FOSWLY/vot-worker)
- [vot-new.toil-dump.workers.dev](https://github.com/FOSWLY/vot-worker) (⚠️ doesn't work in Russia)

#### Media Proxy-server

It's necessary for proxying `.m3u8` files and correcting the translation for indirect links to `.mp4` or `.webm`(for more information in the repository)

- [media-proxy.toil.cc](https://github.com/FOSWLY/media-proxy)

#### VOT-Backend

It's necessary to translate additional sites that use the `.m3u8` or `.mpd` video format.

- [vot.toil.cc](https://github.com/FOSWLY/vot-backend)

## How to build an extension?

1. Install Node.js 18.18+ / Bun.sh
2. Install dependencies:

```bash
npm install
```

Bun:

```bash
bun install --yarn
```

3. Building an extension:

3.0. All versions at once:

```bash
npm run build
```

3.1. All minified versions at once:

```bash
npm run build:min
```

3.2. Only the regular version:

```bash
npm run build:default
```

3.3. Only the usual min. versions:

```bash
npm run build:default-min
```

### How to patch vot.js?

1. Make the necessary changes to node_modules/@vot.js/package_name/required file
2. Save the changes using:

NPM:

```bash
npx patch-package @vot.js/package_name
```

Bun:

```bash
bunx patch-package --use-yarn @vot.js/package_name
```

Do not use patches from the `bun patch` or from any npm packages. They will be incompatible with the patch-package, and may also break when updating the package.

### How to update localization files?

For all interaction with localization files, the localize-tui utility is made.

To call the utility, use the command:

NPM:

```bash
npx @toil/localize-tui
```

Bun:

```bash
bunx @toil/localize-tui
```

or

```bash
bun localize
```

You can read more about the utility [here](https://github.com/ilyhalight/localize)

## Customization of appearance:

The extension supports customization of the appearance using Stylus, Stylish and other similar extensions

Example of changing styles:

```css
/* ==UserStyle==
@name VOT-styles
@version 16.09.2023
@namespace vot-styles
@description LLL
@author Toil
@license No License
==/UserStyle== */

:root {
--vot-font-family: "Roboto", "Segoe UI", BlinkMacSystemFont, system-ui,
-apple-system;

--vot-primary-rgb: 139, 180, 245;
--vot-onprimary-rgb: 32, 33, 36;
--vot-surface-rgb: 32, 33, 36;
--vot-onsurface-rgb: 227, 227, 227;

--vot-subtitles-color: rgb(var(--vot-onsurface-rgb, 227, 227, 227));
--vot-subtitles-passed-color: rgb(var(--vot-primary-rgb, 33, 150, 243));
}
```

## The extension has been tested in the following browsers:

| Status | Browser | Min. Browser Version | Platform | Extension |
| ------ | ------------------------- | -------------------- | ----------------------- | ------------------------------------------------------------------------------------------- |
| ⠀✅ | Firefox Developer Edition | v106 | Windows | Tampermonkey (MV2), FireMonkey, VioletMonkey, Greasemonkey |
| ⠀✅ | Firefox | v116.0.2 | Windows, Linux, Android | Tampermonkey (MV2), Violetmonkey |
| ⠀✅ | Firefox Nightly | v118.0a1 | Windows, Android | Tampermonkey (MV2) |
| ⠀✅ | LibreWolf | v100.0.2-1 | Windows | Tampermonkey (MV2) |
| ⠀✅ | Brave | v1.46 | Windows | Tampermonkey (MV2) |
| ⠀✅ | MS Edge | v106.0.1370.34 | Windows, Linux | Tampermonkey (MV2) |
| ⠀✅ | Cent Browser | v4.3.9.248 | Windows | Tampermonkey (MV2) |
| ⠀✅ | Cent Browser Beta | v5.0.1002.182 | Windows | Tampermonkey (MV2) |
| ⠀✅ | Google Chrome | v106 | Windows, MacOS, Linux | Tampermonkey (MV2), Tampermonkey (MV3), Violetmonkey, OrangeMonkey, User Javascript and CSS |
| ⠀✅ | Opera GX (LVL4) | core91 | Windows | Tampermonkey Opera |
| ⠀✅ | Opera GX (LVL5) | core109 | Windows | Tampermonkey Opera |
| ⠀✅ | Opera | v92.0.4561.43 | Windows | Tampermonkey Opera |
| ⠀✅ | Vivaldi | 5.7.2921.63 | Windows, Linux | Tampermonkey (MV2) |
| ⠀✅ | Safari | v15.6.1 | MacOS, iOS | Userscripts, Tampermonkey |
| ⠀✅ | Kiwi Browser | v116.0.5845.61 | Android | Tampermonkey (MV2) |
| ⠀✅ | Yandex Browser | v24.4 | Windows | Tampermonkey (MV2), Tampermonkey (MV3) |
| ⠀✅ | Arc | v1.6.1 | Windows | Tampermonkey (MV3) |
| ⠀✅ | Incognition | v4.1.1.0 (v125) | Windows | Tampermonkey (MV3), Tampermonkey (MV2) |

Min. Browser version it's a minimal version of which extension has been tested. However, this doesn't mean that it willn't run in older versions. Please note that we **don't** support or fix errors in outdated browsers.

To activate the script in Tampermonkey (MV3), you must [enable "Developer Mode"](https://www.tampermonkey.net/faq.php#Q209)

## Tested in the following extensions for user scripts:

| Status | Browser | Extension |
| -------------------------------------------------------------------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------- |
| ⠀✅ | Any | Tampermonkey Legacy (MV2) |
| ⠀✅ | Opera | Tampermonkey Opera |
| ⠀✅ | Chrome | Tampermonkey (MV3) |
| ⠀⚠️ It works in proxying mode | Safari | Userscripts, Tampermonkey |
| ⠀✅ | Any | Violetmonkey |
| ⠀❔ | Any | [AdGuard Usercripts](https://kb.adguard.com/en/general/userscripts#supported-apps) |
| ⠀[Install guide](https://github.com/ilyhalight/voice-over-translation/wiki/%5BEN%5D-FAQ#how-to-use-the-extension-with-firemonkey) | Firefox | Firemonkey |
| ⠀✅ | Firefox | Greasemonkey |
| ⚠️ requestIdleCallback is full of errors, but it works | Any | OrangeMonkey |
| ⠀[Install guide](https://github.com/ilyhalight/voice-over-translation/wiki/%5BEN%5D-FAQ#how-to-use-the-extension-with-user-js-and-css) | Any | User Javascript and CSS |

![example btn](https://github.com/ilyhalight/voice-over-translation/blob/master/img/example_en.png "btn")

> Based on [sodapng/voice-over-translation](https://github.com/sodapng/voice-over-translation) project (license MIT)