translation.rst 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. Translation & Multi-Language Support
  2. ====================================
  3. Default Language
  4. ----------------
  5. To adjust the default language of a project, navigate to
  6. ``projectname/settings/base.py``. Change both the ``LANGUAGE_CODE`` setting and
  7. the ``LANGUAGES`` setting. For example:
  8. .. code-block:: python
  9. LANGUAGE_CODE = 'es'
  10. LANGUAGES = [
  11. ('es', _('Spanish'))
  12. ]
  13. Note that these settings are both in use to communicate to the users' browser
  14. about the default language of the project. This ensures that users requiring
  15. assistive technology have a smooth experience using the site. These settings do
  16. not, on their own, translate or enable multiple languages on the project.
  17. `See a full list of language codes from W3.
  18. <https://www.w3docs.com/learn-html/html-language-codes.html>`_
  19. Translate the UI
  20. ----------------
  21. Wagtail CRX provides all text throughout the UI and templates as translatable
  22. strings using Django's internationalization system (often abbreviated "i18n").
  23. To learn more about how translation works, read Wagtail's official `documentation
  24. <http://docs.wagtail.io/en/latest/advanced_topics/i18n/>`_ on the topic.
  25. Translate Page Content
  26. ----------------------
  27. Translation of model fields can be most efficiently and safely achieved via the
  28. well-known `Wagtail Model Translation <https://github.com/infoportugal/wagtail-modeltranslation>`_
  29. package.
  30. Please note that, due to Wagtail CRX architecture, some model fields are not exposed
  31. to the translation package by default, but you can expose these fields in your ``models.py``.
  32. See below how that would be done for the ``body`` field for a specific ``WebPage``
  33. model in ``website/models.py``:
  34. .. code-block:: python
  35. class WebPage(CoderedWebPage):
  36. body_content_panels = []
  37. content_panels = CodredWebPage.content_panels + [
  38. FieldPanel('body'),
  39. ]
  40. Changing Language of the Admin Dashboard
  41. ----------------------------------------
  42. See Wagtail's `translation documentation <http://docs.wagtail.io/en/latest/advanced_topics/i18n/>`_,
  43. to enable a default language in the administration panel.
  44. Supported Languages
  45. -------------------
  46. Wagtail CRX is currently provided in English (US). However, it supports translation.
  47. If you use Wagtail CRX in a different language, please consider contributing
  48. your translations!