Giter VIP home page Giter VIP logo

flask-microblog-plus-infra's People

Contributors

timcondit avatar

Watchers

 avatar

flask-microblog-plus-infra's Issues

App offering to translate English (default language)

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:

  1. Start application with flask run
  2. Go to http://127.0.0.1:5000/index
  3. Ensure your browser is configured for English
  4. Add some text in English into the text area below "Say something"
  5. Submit it
  6. See Translate link activate

Expected 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.
image

Desktop (please complete the following information):

  • OS: MacOS 10.14.6
  • Browser: Firefox
  • Version: 76.0.1 (64-bit)

Smartphone (please complete the following information):

  • Device: n/a
  • OS: n/a
  • Browser: n/a
  • Version: n/a

Additional context
Add any other context about the problem here.

Why are configured languages not selected for translation?

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:

  1. Start application with flask run
  2. Go to http://127.0.0.1:5000/index
  3. Ensure your browser is configured for English
  4. Add some text in Spanish or Italian into the text area below "Say something"
  5. Submit it
  6. Note that the Translate link does not activate

Expected 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.
image

Desktop (please complete the following information):

  • OS: MacOS 10.14.6
  • Browser: Firefox
  • Version: 76.0.1 (64-bit)

Smartphone (please complete the following information):

  • Device: n/a
  • OS: n/a
  • Browser: n/a
  • Version: n/a

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)
'嗨,你今天好吗?'

Where's the "to" parameter? This reproduces consistently.

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:

  1. Start application with flask run
  2. Go to http://127.0.0.1:5000/index
  3. Ensure your browser is configured for English
  4. Add some text in English into the text area below "Say something"
  5. Submit it
  6. Click Translate for the submitted post.
  7. See error in screenshot

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.
image

image

Desktop (please complete the following information):

  • OS: MacOS 10.14.6
  • Browser: Firefox
  • Version: 76.0.1 (64-bit)

Smartphone (please complete the following information):

  • Device: n/a
  • OS: n/a
  • Browser: n/a
  • Version: n/a

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)
'嗨,你今天好吗?'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.