mikebarkmin / lesbar.club

Test the readability of your texts. Simple. Fast. Free.
https://lesbar-club.vercel.app/
MIT License
0 stars 6 forks source link

Allow Language Selection #4

Closed mikebarkmin closed 4 years ago

mikebarkmin commented 4 years ago

Allow to select a different language. The backend supports at the moment english and german. The supported languages should be fetch from the backend.

mikebarkmin commented 4 years ago

Maybe the initial language could be the one of the browser.

Abelarm commented 4 years ago

Hi, I would like to work on this. I'll start with getting the language from browser. (does the UI automatically change if, for example en_GB is selected?

mikebarkmin commented 4 years ago

Thanks for help :+1:

I think that I was not very clear. The change of language should result in two different things.

  1. The backend should receive that a text is written in a different language. Therefore, we must make the language key of the json which will be send to the server dynamic.
  2. Translate the UI. At the moment there is nothing implemented to translate the ui. There are two possible ways to implement that. 2.1. Client-Side: Use Javascript to store the different locales and translate everything on the client. After a different language is selected we would change the strings with Javascript and no reload would be necessary. Therefore, we have to do most of the work in index.js. 2.2 Server-Side: Use Flasks template engine to translate strings. After a different language is selected we need to refresh the page and send the language information to flask. Therefore, we have to do most of the work in index.html and __init__.py

I do not prefer one solution over the other. So it is up to you. But I will of course help you, if you are stuck or need some advice.

Abelarm commented 4 years ago

1) I will select the language based on the browser. Default will be German.

2) I think, since right now, there are only two language involved and the amount of text is really small (I count just 9 strings) the client-side option can be a good choice.

In both case I need a translation of the strings, since I don't speak German :(

mikebarkmin commented 4 years ago
de en
Text Text
Überprüfen Check
Gib den zu prüfenden Text hier ein... Enter the text to be checked here...
Zeichen Characters
Buchstaben Letters
Silben Syllables
Sätze Sentences
Wörter Words

Flesch-Reading-Ease, Wienersachtext-Formel-4 and Lesbarkeitsindex are names of the metrics. So need to translate them.