Chapter 9. Internationalization and Localization

Web applications usually are not limited to one geographical region or to serving people from one linguistic domain. For example, a web application intended for users in Europe will be expected to support other European languages such as German, French, Italian, Spanish, and so on, apart from English. This chapter will cover the basics of how to enable support for multiple languages in a Flask application.

In this chapter, we will cover the following recipes:

  • Adding a new language
  • Lazy evaluation and the gettext/ngettext functions
  • Global language-switching action

Introduction

Adding support for a second language in any web application is a tricky affair. It increases a bit of overhead every time some ...

Get Flask Framework Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.