Comments (24)
TODO: avoid
def __init__(self, request: Request = Request()):
. See more: https://youtu.be/Cj6O9FUjiAAFlask warning:
[flake8] [W] Do not perform function calls in argument defaults. The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-ti me function call. If this is intended, assign the function call to a module-level variable and use that variable as a default value.
This is fixed in the new-models
branch
translate/translatepy/translate.py
Line 28 in c6cce0f
from translate.
TODO: add logger (like loguru)
The server is going to use nasse
, which already has a custom logger which we could use.
See also: Nasse — Logging
from translate.
Btw @ZhymabekRoman if you look at 5817dd6 I reorganized the CLI a bit (needs a bit more work) and I created a TUI using Textual
![Screenshot 0005-08-23 at 02 21 16](https://private-user-images.githubusercontent.com/40539549/262511953-ad22f064-22b2-4733-9014-cc211a59ba41.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2NDY3NTYsIm5iZiI6MTcxOTY0NjQ1NiwicGF0aCI6Ii80MDUzOTU0OS8yNjI1MTE5NTMtYWQyMmYwNjQtMjJiMi00NzMzLTkwMTQtY2MyMTFhNTliYTQxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI5VDA3MzQxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc0NTkyYzM2OWQ1NGU3Y2IzMzkyMDk4OGRkMDdjNWY1OTUyNmMyMzliMmJmYTk3NjQxNTkwNTc0OTI2MjdlYzEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.K2J7MnFBszzeaNHq1Htzs3wyH1JAb4aOWMs0Mh2mn3I)
![Screenshot 0005-08-23 at 02 21 34](https://private-user-images.githubusercontent.com/40539549/262511950-6553c2c8-bbdf-41f8-8d18-2d0f1d2efe35.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2NDY3NTYsIm5iZiI6MTcxOTY0NjQ1NiwicGF0aCI6Ii80MDUzOTU0OS8yNjI1MTE5NTAtNjU1M2MyYzgtYmJkZi00MWY4LThkMTgtMmQwZjFkMmVmZTM1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI5VDA3MzQxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTAyZGNlYTk2ZjdjOWEyMjQ0MmVmYzY2ZWFmN2U1MmJhZmFlZDk1MjU5ZjNjMGVlOTg2YjcwMzcwZDNiZWFiNGYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.4S06zcM2INs7Sc_1iphzBsWTK5eyXzl6-6E20Al_GaU)
![Screenshot 0005-08-23 at 02 21 50](https://private-user-images.githubusercontent.com/40539549/262511948-5ad48685-de96-4592-acf7-d8507687070a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2NDY3NTYsIm5iZiI6MTcxOTY0NjQ1NiwicGF0aCI6Ii80MDUzOTU0OS8yNjI1MTE5NDgtNWFkNDg2ODUtZGU5Ni00NTkyLWFjZjctZDg1MDc2ODcwNzBhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI5VDA3MzQxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM3N2I1NGRlZGEyYzIzZmEwMmIzMjQwODBiMGI3MjYwODhjZDA2ZGE1YWJiOGYzZTNlNTdmNjJhZjU3MWJiMjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.6b7Lp7AQlpPmJuObfxhm3iS6QmICWqJ7WGllfnb41To)
![Screenshot 0005-08-23 at 02 22 11](https://private-user-images.githubusercontent.com/40539549/262511944-ef8883a9-7a7d-4584-a182-7e6d0834982f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2NDY3NTYsIm5iZiI6MTcxOTY0NjQ1NiwicGF0aCI6Ii80MDUzOTU0OS8yNjI1MTE5NDQtZWY4ODgzYTktN2E3ZC00NTg0LWExODItN2U2ZDA4MzQ5ODJmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI5VDA3MzQxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA4YjkzZTBmMzM2NTg0MzY3OWIxMjcxMjMzNDNhNjhkMWJiYjFjZjBlYjliM2FmNzA4MTRmYTlkMWFkMjFlZjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.tlg1t5tyKegJvA-bsOoF6itjO4cSle06zb7QLCq8uxA)
![Screenshot 0005-08-23 at 02 23 07](https://private-user-images.githubusercontent.com/40539549/262511940-237b01be-9cf0-4866-968d-8c03d679138e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2NDY3NTYsIm5iZiI6MTcxOTY0NjQ1NiwicGF0aCI6Ii80MDUzOTU0OS8yNjI1MTE5NDAtMjM3YjAxYmUtOWNmMC00ODY2LTk2OGQtOGMwM2Q2NzkxMzhlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI5VDA3MzQxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTVkNWUzMTc0YzdmNTQxNWY2NzM5NWY4Y2FlZDMwZmFjZmZjNDdlOWZiNjRmYjMwOWE5ZWFmZjkxMDJkN2Q2MzEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.9I1W0ct4KrMlT3APo0qkQ9w9W0gOxobsF9KHdNMZDbk)
from translate.
Reimplemented HTML translation
from translate.
The website works again!
![Screenshot 0005-08-26 at 19 45 05](https://private-user-images.githubusercontent.com/40539549/263488542-846888a3-e044-47f1-86b3-2cb765227a01.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2NDY3NTYsIm5iZiI6MTcxOTY0NjQ1NiwicGF0aCI6Ii80MDUzOTU0OS8yNjM0ODg1NDItODQ2ODg4YTMtZTA0NC00N2YxLTg2YjMtMmNiNzY1MjI3YTAxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI5VDA3MzQxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNiMmJmN2UyMzljNmI5ZmVlYzliYjhhZjYzNjUzMTBkN2ZiNGFlNGZjNjYwMDg3ZTc0MTlhZDUyZjc0ZTliNTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.wvE0nVf8Ee_QLxbLyvGaGJdJm_EWVV4Ty2zDq6Vb1Fk)
from translate.
Added the Papago translator from Naver
![Screenshot 0005-08-28 at 20 06 23](https://private-user-images.githubusercontent.com/40539549/263784708-cc352296-745c-4a14-a9c1-9b377cbac30a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2NDY3NTYsIm5iZiI6MTcxOTY0NjQ1NiwicGF0aCI6Ii80MDUzOTU0OS8yNjM3ODQ3MDgtY2MzNTIyOTYtNzQ1Yy00YTE0LWE5YzEtOWIzNzdjYmFjMzBhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI5VDA3MzQxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJlOGQxOTZlNGNkNTM5ZTU0YzhjMTNkMzM0ZTY5M2ZhMWI2Mjk4ZWFhMDgxNzBiNDQ1NWYyMTJmMmFjYmM5MzImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ceX2sDXtl5k8HN0XXkkNvhXZFpfpj8Ncf3fBglqe-GY)
from translate.
- TODO: new service - quillbot (I have tried to implement this. However, we may need to bypass Cloudflare security first)
from translate.
Wow, judging by the list, there's a lot of work to be done 😃
from translate.
New Translate Services:
- ABBYY Lingvo
New languages:
- Turkish, Ukranian and Indonesian to DeepL - https://www.deepl.com/en/blog/deepl-welcomes-turkish-and-indonesian
- Ukranian to Reverso
Other changes:
- Mypy static type hint support
from translate.
New Translate Services:
- ABBYY Lingvo
New languages:
- Turkish, Ukranian and Indonesian to DeepL - https://www.deepl.com/en/blog/deepl-welcomes-turkish-and-indonesian
- Ukranian to Reverso
Other changes:
- Mypy static type hint support
Added to the list !
from translate.
Here is what is currently happening on the new-models
branch !
Brand new models have been implemented !
They now all include the raw
attribute (which is optional)
Most of them support rich string representation, which can be generated through the __pretty__
method on the Result model :
By passing in the cli=True
parameter, you can even get colors !
The brand new BaseTranslator
New dictionary, example methods and alternative methods have been added !
It natively handles bulk translations, transliterations, ... on everything ! Through the use of typing.overload
, the type checkers automatically know if the return value should be an iterable (if a bulk action) or if it should be a normal result model.
Moreover, the Result
model actually implements __iter__
to avoid mistakes when looping over Translator.translate()
even if a single translation is done.
The iterable returned by bulk actions is a custom LazyIterable
which actually loads things if needed and stores them.
TRANSLATEPY_SCREEN_REC.mp4
My bad the method is not
transliteration
buttransliterate
... (maybe could alias it ?)
Now I need to modify the actual translators implementations and re-implement Translate
(aggregate translators) using BaseTranslator
from translate.
Updated all of the translators 🍡
from translate.
And the Translate
class is working !
Now, it inherits from BaseTranslator
and its code is much simpler 🧃
from translate.
Wow! @Animenosekai, Great job ✨
from translate.
TODO: add logger (like loguru)
from translate.
TODO: Integrate fake-useragent
from translate.
TODO: avoid def __init__(self, request: Request = Request()):
. See more: https://youtu.be/Cj6O9FUjiAA
Flask warning:
[flake8] [W] Do not perform function calls in argument defaults. The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-ti
me function call. If this is intended, assign the function call to a module-level variable and use that variable as a default value.
from translate.
TODO: add logger (like loguru)
The server is going to use
nasse
, which already has a custom logger which we could use.See also: Nasse — Logging
Great job! 🚀
from translate.
TODO: Telegram bot 😀
from translate.
TODO: Telegram bot 😀
Hmmmm I'm not sure if this should be done by this repo or in another repo
from translate.
TODO: Telegram bot 😀
Hmmmm I'm not sure if this should be done by this repo or in another repo
Yeah, maybe in separated repo
from translate.
Btw @ZhymabekRoman if you look at 5817dd6 I reorganized the CLI a bit (needs a bit more work) and I created a TUI using Textual
Wow! 😯 Great job @Animenosekai ! I like this!
from translate.
- TODO: Introduce custom Request class with undetected-chromedriver backend to bypass bot detection algorithms with original Chrome fingerprints
from translate.
- TODO: add Arabic to DeepL
from translate.
Related Issues (20)
- The `example` function in `YandexTranslate` without translation HOT 7
- Bulk Translation support? HOT 2
- NoResult: No service has returned a valid result HOT 8
- Missing spaces between tags when using translate_html HOT 2
- Bing Translator throwing error code 205 HOT 5
- Not accurate source language autodetection HOT 14
- Language auto detecting is broken in MyMemory HOT 3
- example() not working HOT 1
- Different Translation on Yandex HOT 11
- Result mismatch Google Translate HOT 5
- MicrosoftTranslate.text_to_speech is not working HOT 8
- Is the DeepL split text correct? HOT 3
- [SERVER]: cannot import name 'General' from 'nasse.config' HOT 1
- the lang tr is not supported by deepl error (even though it has) HOT 1
- How to set timeout for Translate requesting? HOT 8
- Links and hashtags seem to change after translation HOT 10
- ReversoTranslator BUG HOT 7
- No module named 'translatepy.utils' (on Windows) HOT 2
- Traditional Chinese HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from translate.