D
D
Dmitry Labutin2015-10-24 15:21:37
Internationalization and localization
Dmitry Labutin, 2015-10-24 15:21:37

How to make multilingual pages in Flask?

There are a lot of tips on the Internet on how to make multilingual sites on Flask.
For example, a good article here: habrahabr.ru/post/236861
Almost everywhere it is recommended to use flask-babel.
This is all very good if you need to translate individual phrases.
And what are the best practices if I have text in Jinja2 templates? Well, i.e. the site is almost static and there is no full-fledged CMS. There are pages with text. Make templates for each supported language? And depending on the selected language in the view, use a file with the appropriate template?
And what about the data in the database? For example, this is a product catalog. There the name, characteristics can be through Babel. What about descriptions? There are long texts. In base to store the description under each language?
There are other options? Or maybe there are even some Flask extensions for such cases?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question