Handling multilingual fields

Django uses the internationalization mechanism to translate verbose strings in the code and templates. But it's up to the developer to decide how to implement the multilingual content in the models. We'll show you a couple of ways for how to implement multilingual models directly in your project. The first approach will be using language-specific fields in your model.

This approach has the following features:

  • It is straightforward to define multilingual fields in the model.
  • It is simple to use the multilingual fields in database queries.
  • You can use contributed administration to edit models with the multilingual fields, without additional modifications.
  • If you need to, you can effortlessly show all of the translations of an object in the same template.
  • After changing the amount of languages in the settings, you will need to create and run migrations for all multilingual models.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.30.162