Skip to content

vtrans is a powerful Python library that brings seamless, real-time language translation with support for a wide range of languages — including lesser-known ones like Sanskrit, Bhojpuri, and more. It auto-updates its supported languages every time you import it, so you're always using the latest from Google's translation system.

License

Notifications You must be signed in to change notification settings

vertexvignesh/Vtrans

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌐 vtrans


📌 About

vtrans is a free, self-updating, and unlimited language translating library built on top of googletrans. While googletrans gets outdated and stuck with limited languages, vtrans stays fresh by auto-updating itself every time you import it 😎


⚡ Features

🔄 Different from googletrans

  • 🔥 Auto-updates language list directly from Google Translator's site
  • 🗣️ Supports extra languages like Sanskrit, Bhojpuri, etc.
  • 🔃 Keeps up with Google’s latest language support
  • 📡 Always fresh, always ready to translate like a beast

✅ Similar to googletrans

  • ⚡ Fast and reliable
  • 🌐 Auto language detection
  • 📦 Bulk translations
  • 🚀 HTTP/2 support
  • 🧱 Same familiar structure

🛠️ How It Works

vtrans scrapes the latest language list from Google Translate Supported Languages and replaces the old LANGUAGES dictionary in googletrans's constants. This way, it's always up to date 💡


📦 Installation

pip install vtrans

🧪 Basic Usage

from vtrans import Translator

translator = Translator()
output = translator.translate("This library can translate languages", "ta")
print(output.text)  # ➜ இந்த நூலகம் மொழிகளை மொழிபெயர்க்கக்கூடும்

🔍 Get Available Languages

import vtrans

langs = vtrans.LANGUAGES
print(langs)        # Print the full dictionary
print(len(langs))   # Number of supported languages

🕐 First Import

On first use:

import vtrans
# Setup config file
# Checking for updates...
# Please wait...
# Update finished! 🎉
# Ready to translate

📴 Disable Auto Update

import vtrans
vtrans.config(auto_updating=False)

🔁 Manual Update

import vtrans
vtrans.update()

🙊 Disable “Ready to translate” Message

import vtrans
vtrans.remove_unwanted_printing()

This change is saved permanently in your config file


📡 HTTP/2 Support

httpx is used for requests, so HTTP/2 works out-of-the-box:

from vtrans import Translator

translator = Translator()
print(translator.translate('테스트')._response.http_version)  # ➜ 'HTTP/2'

🧠 Advanced Usage

Bulk Translation

texts = ['The quick brown fox', 'jumps over', 'the lazy dog']
translations = translator.translate(texts, dest='ko')
for t in translations:
    print(t.origin, '->', t.text)

🔎 Language Detection

from vtrans import Translator

translator = Translator()

print(translator.detect('この文章は日本語で書かれました。'))
# ➜ <Detected lang=ja confidence=0.64>

🌍 Custom Google Domains

translator = Translator(service_urls=[
    'translate.google.com',
    'translate.google.co.kr',
])

⚠️ Notes

  • Max characters per translation: 15,000
  • Not officially supported by Google
  • Can break if Google blocks your IP (5xx errors)
  • Based on googletrans, but enhanced for more power ⚙️

📄 License

MIT License © 2023 S.Vigneswaran

Permission is granted, free of charge, to use, copy, modify, distribute, and sell this software with the included license text. No warranty or liability is provided.


Made with ❤️ by Vicky (S.Vigneswaran)

About

vtrans is a powerful Python library that brings seamless, real-time language translation with support for a wide range of languages — including lesser-known ones like Sanskrit, Bhojpuri, and more. It auto-updates its supported languages every time you import it, so you're always using the latest from Google's translation system.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages