Package: vtrans
vtransvtransis aself-updating,free, andunlimitedlanguage
translating library. It works with thegoogletranslibrary.Wait, but this is not like googletrans.
googletrans can't update its languages, so you can only
use limited languages. However,vtransis different. It
updates itself every time you import it.FeaturesDifferent from googletransupdate it selfYou can use exatra langauges like sansrit,bhojpuri ect....... .but googletrans have not this languagesWhen the google update their google translator it automatically
update it selfyou can use extra languages compare to other translating librarywhat langauges are avaiable in google translator,you can use all the
languages by this librarySimilarities with googletransFast and reliable: It uses the same servers as
translate.google.com.Auto language detectionBulk translationsHTTP/2 supportSimilar structureHow it worksvtrans is essentially a language-updatable version of
googletrans. It modifies the LANGUAGES
dictionary in constants.py of googletrans by
scraping the table fromgoogle translator supported
langauges. It
retrieves the values from the table and creates a new dictionary, which
replaces the existing LANGUAGES dictionary.InstallingTo install the vtrans package, use the following command:$pipinstallvtrans==3.0.0How to use this library (simple)fromvtransimportTranslatortranslator=Translator()output=translator.translate("This library can translate languages","ta")Find available languagesTo find what languages are available in vtrans:importvtranslangs=vtrans.LANGUAGESprint(langs)# It will give you a dictionary# To find the number of available languagesprint(len(langs))First importing of vtransIf you import this library for the first time, it will take some time to
complete the configurations. It changes the LANGUAGES
variable in constants.py of googletrans to
match the current version of Google Translator. The first import will
display the following:importvtrans# Setup config file# Checking for updates (auto-updating). If you want to stop auto-updating, use this code: `vtrans.config(auto_updating=False)`# Please wait for a few seconds, the update is in progress...# Update finished. Now you can use extra languages.# Ready to translateOnce you have imported vtrans for the first time, you do
not need to use auto-updating. Auto-updating slows down the library, as
it searches for updates whenever you import vtrans.
Enabling or disabling auto-updating is based on your needs and choice.How to disable auto-updateIf you want to disable auto-updating:importvtransvtrans.config(auto_updating=False)Now vtrans will not update whenever you import it.How to update manuallyIf you want to update manually, make sure you have disabled
auto-updating:importvtransvtrans.update()Now the languages are updated manually.How to disable unwanted printingWhenever vtrans is initialized and ready to translate, it
prints "Ready to translate". If you want to disable this:importvtransvtrans.remove_unwanted_printing()You don't need to do this every time. Once you have changed the value,
it will make changes in the config.txt file.HTTP/2 supportThis library uses httpx for HTTP requests, so HTTP/2 is
supported by default. You can check if HTTP/2 is enabled and working by
accessing the ._response.http_version attribute of the
Translated or Detected object:fromvtransimportTranslatortranslator=Translator()translator.translate('테스트')._response.http_version# 'HTTP/2'Basic Usage ==========If the source language is not given, Google Translate attempts to detect
the source language.fromvtransimportTranslatortranslator=Translator()translator.translate('안녕하세요.')# <Translated src=ko dest=en text=Good evening. pronunciation=Good evening.>translator.translate('안녕하세요.',dest='ja')# <Translated src=ko dest=ja text=こんにちは。 pronunciation=Kon'nichiwa.>translator.translate('veritas lux mea',src='la')# <Translated src=la dest=en text=The truth is my light pronunciation=The truth is my light>Customize service URLYou can use a different Google Translate domain for translation. If
multiple URLs are provided, it randomly chooses a domain.fromvtransimportTranslatortranslator=Translator(service_urls=['translate.google.com','translate.google.co.kr',])Advanced Usage (Bulk)Arrays can be used to translate a batch of strings in a single method
call and a single HTTP session. The same method shown above also works
for arrays.translations=translator.translate(['The quick brown fox','jumps over','the lazy dog'],dest='ko')fortranslationintranslations:print(translation.origin,' -> ',translation.text)# The quick brown fox  ->  빠른 갈색 여우# jumps over  ->  이상 점프# the lazy dog  ->  게으른 개Language detectionThe detect method identifies the language used in a given
sentence.fromvtransimportTranslatortranslator=Translator()translator.detect('이 문장은 한글로 쓰여졌습니다.')# <Detected lang=ko confidence=0.27041003>translator.detect('この文章は日本語で書かれました。')# <Detected lang=ja confidence=0.64889508>translator.detect('This sentence is written in English.')# <Detected lang=en confidence=0.22348526>translator.detect('Tiu frazo estas skribita en Esperanto.')# <Detected lang=eo confidence=0.10538048>Note on library usageDISCLAIMER: Yes, I am aware that most of the functions are similar to
googletrans because I worked with the base of
googletrans. However, vtrans can update its
languages, allowing you to use more languages. This is an unofficial
library that uses the web API of translate.google.com and is not
associated with Google.The maximum character limit on a single text is 15k.Due to limitations of the web version of Google Translate, this API
does not guarantee stability at all times. Please use this library
if you don't require stability.If you encounter HTTP 5xx errors or errors like #6, it is likely
because Google has banned your client IP address.LicenseGoogletrans is licensed under the MIT License. The terms are as follows:Copyright 2023 S.VigneswaranPermission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.