Greasy Fork is available in English.

Useless Things Series: Auto Translation Fun

Automatically translates webpages to random languages except English for fun.

Fejlesztő
Useless Things Series: ??
Napi telepítések
0
Telepítések száma
7
Értékelések
0 0 0
Verzió
1.0
Létrehozva
2023.07.14.
Frissítve
2023.07.14.
Licensz
MIT
Érvényes
Minden oldal

## Useless Things Series: Auto Translation Fun
### Description: Automatically translates webpages to random languages except English for fun.

### Instructions:

1. Configuration:
- `translationProbability`: This variable determines the initial probability of translation. It is set to 0.2, which means there is a 20% chance of translation on each interval.
- `translationInterval`: This variable specifies the time interval in milliseconds. The script will attempt to translate the page every 5 seconds (5000 milliseconds).

2. Array of Target Languages:
- The script defines an array called `targetLanguages` which contains language codes for languages other than English. The listed languages are: Spanish ('es'), French ('fr'), German ('de'), Italian ('it'), Japanese ('ja'), Korean ('ko'), Portuguese ('pt'), Russian ('ru'), and Simplified Chinese ('zh-CN').

3. Function to Generate a Random Language:
- The script includes a function called `generateRandomLanguage()` that selects a random language code from the `targetLanguages` array.

4. Function to Translate the Webpage:
- The script defines a function called `translatePage()` that checks the current language of the webpage. If the language is English and the random probability condition is met, it generates a random language and constructs a translation URL using Google Translate. The script then redirects the user to the translated page.

5. Activation of Translation:
- The script sets an interval using `setInterval()` to trigger the `translatePage()` function at the specified `translationInterval` (5 seconds). This ensures that the translation process is repeated automatically.

Please note that this script uses the `window.location.href` property to redirect the user to the translated page. Make sure you understand the behavior and implications of this before using the script.

Make sure you have a user script manager extension installed in your browser (such as Tampermonkey or Greasemonkey) and add this script to it. The script will then run automatically on all websites, attempting to translate them according to the defined configuration.

Enjoy the useless fun of automatically translating webpages to random languages!