timcondit / flask-microblog-plus-infra Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Describe the bug
I've completed The Flask Mega-Tutorial Part XIV: Ajax. When I run the application and add a blog post, it's offering to translate my (English) language posts. English is my native language, so this is redundant.
Ignore the error in the API call. That's a separate issue (#5).
To Reproduce
Steps to reproduce the behavior:
flask run
Translate
link activateExpected behavior
For English text entered into a browser configured for English, the Translate
option should not be available.
For non-English text entered into a browser configured for English, the Translate
option should be available.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
Describe the bug
I've completed The Flask Mega-Tutorial Part XIV: Ajax. When I run the application and add a blog post, it's not offering to translate some configured non-English language posts. This happens with Spanish (es
) or Italian (it
), both of which are configured in config.py
:
class Config:
. . .
LANGUAGES = ["ar", "de", "en", "es", "fr", "it", "zh-Hans"]
Ignore the error in the API call. That's a separate issue (#5).
To Reproduce
Steps to reproduce the behavior:
flask run
Translate
link does not activateExpected behavior
For English text entered into a browser configured for English, the translate
option should not be available.
For non-English text entered into a browser configured for English, the translate
option should be available.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
If it helps, here are some ready-made strings to pass into the application.
~/Bender/googledrive/1_Projects/the-flask-mega-tutorial/flask-microblog-plus-infra/microblog develop* ⇡ 42s
venv ❯ flask shell
>>> from app.translate import translate
>>> translate('Hi, how are you today?', 'en', 'es') # English to Spanish
'Hola, ¿cómo estás hoy?'
>>> translate('Hi, how are you today?', 'en', 'de') # English to German
'Hallo, wie geht es dir heute?'
>>> translate('Hi, how are you today?', 'en', 'it') # English to Italian
'Ciao, come stai oggi?'
>>> translate('Hi, how are you today?', 'en', 'fr') # English to French
'Salut, comment vas-tu aujourd'hui ?'
>>> translate('Hi, how are you today?', 'en', 'ar') # English to Arabic
'مرحبا، كيف حالك اليوم؟'
>>> translate('Hi, how are you today?', 'en', 'zh-Hans') # English to Chinese (Simplified)
'嗨,你今天好吗?'
Describe the bug
I've completed The Flask Mega-Tutorial Part XIV: Ajax. When I run the application add a blog post, then try to translate the text, the API call is missing the parameter which specifies the language to translate to.
To Reproduce
Steps to reproduce the behavior:
flask run
Translate
for the submitted post.Expected behavior
The text should be translated from the source language to whatever language the user's browser is configured to use. My destination language is English, so I used non-English source strings from earlier translations (via direct calls to the API).
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
These are the direct API calls mentioned above.
~/Bender/googledrive/1_Projects/the-flask-mega-tutorial/flask-microblog-plus-infra/microblog develop* ⇡ 42s
venv ❯ flask shell
>>> from app.translate import translate
>>> translate('Hi, how are you today?', 'en', 'es') # English to Spanish
'Hola, ¿cómo estás hoy?'
>>> translate('Hi, how are you today?', 'en', 'de') # English to German
'Hallo, wie geht es dir heute?'
>>> translate('Hi, how are you today?', 'en', 'it') # English to Italian
'Ciao, come stai oggi?'
>>> translate('Hi, how are you today?', 'en', 'fr') # English to French
'Salut, comment vas-tu aujourd'hui ?'
>>> translate('Hi, how are you today?', 'en', 'ar') # English to Arabic
'مرحبا، كيف حالك اليوم؟'
>>> translate('Hi, how are you today?', 'en', 'zh-Hans') # English to Chinese (Simplified)
'嗨,你今天好吗?'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.