i18n.rst 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  1. ====================
  2. Internationalisation
  3. ====================
  4. .. contents::
  5. :local:
  6. :depth: 3
  7. .. _multi_language_content:
  8. Multi-language content
  9. ======================
  10. Overview
  11. --------
  12. Out of the box, Wagtail assumes all content will be authored in a single language.
  13. This document describes how to configure Wagtail for authoring content in
  14. multiple languages.
  15. .. note::
  16. Wagtail provides the infrastructure for creating and serving content in multiple languages.
  17. There are two options for managing translations across different languages in the admin interface:
  18. :ref:`wagtail.contrib.simple_translation<simple_translation>` or the more advanced `wagtail-localize <https://github.com/wagtail/wagtail-localize>`_ (third-party package).
  19. This document only covers the internationalisation of content managed by Wagtail.
  20. For information on how to translate static content in template files, JavaScript
  21. code, etc, refer to the `Django internationalisation docs <https://docs.djangoproject.com/en/3.1/topics/i18n/translation/>`_.
  22. Or, if you are building a headless site, refer to the docs of the frontend framework you are using.
  23. Wagtail's approach to multi-lingual content
  24. -------------------------------------------
  25. This section provides an explanation of Wagtail's internationalisation approach.
  26. If you're in a hurry, you can skip to `Configuration`_.
  27. In summary:
  28. - Wagtail stores content in a separate page tree for each locale
  29. - It has a built-in ``Locale`` model and all pages are linked to a ``Locale`` with the ``locale`` foreign key field
  30. - It records which pages are translations of each other using a shared UUID stored in the ``translation_key`` field
  31. - It automatically routes requests through translations of the site's homepage
  32. - It uses Django's ``i18n_patterns`` and ``LocaleMiddleware`` for language detection
  33. Page structure
  34. ^^^^^^^^^^^^^^
  35. Wagtail stores content in a separate page tree for each locale.
  36. For example, if you have two sites in two locales, then you will see four
  37. homepages at the top level of the page hierarchy in the explorer.
  38. This approach has some advantages for the editor experience as well:
  39. - There is no default language for editing, so content can be authored in any
  40. language and then translated to any other.
  41. - Translations of a page are separate pages so they can be published at
  42. different times.
  43. - Editors can be given permission to edit content in one locale and not others.
  44. How locales and translations are recorded in the database
  45. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  46. All pages (and any snippets that have translation enabled) have a ``locale`` and
  47. ``translation_key`` field:
  48. - ``locale`` is a foreign key to the ``Locale`` model
  49. - ``translation_key`` is a UUID that's used to find translations of a piece of content.
  50. Translations of the same page/snippet share the same value in this field
  51. These two fields have a 'unique together' constraint so you can't have more than
  52. one translation in the same locale.
  53. Translated homepages
  54. ^^^^^^^^^^^^^^^^^^^^
  55. When you set up a site in Wagtail, you select the site's homepage in the 'root page'
  56. field and all requests to that site's root URL will be routed to that page.
  57. Multi-lingual sites have a separate homepage for each locale that exist as siblings
  58. in the page tree. Wagtail finds the other homepages by looking for translations of
  59. the site's 'root page'.
  60. This means that to make a site available in another locale, you just need to
  61. translate and publish its homepage in that new locale.
  62. If Wagtail can't find a homepage that matches the user's language, it will fall back
  63. to the page that is selected as the 'root page' on the site record, so you can use
  64. this field to specify the default language of your site.
  65. Language detection and routing
  66. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  67. For detecting the user's language and adding a prefix to the URLs
  68. (``/en/``, ``/fr-fr/``, for example), Wagtail is designed to work with Django's
  69. builtin internationalisation utilities such as ``i18n_patterns`` and
  70. `LocaleMiddleware`. This means that Wagtail should work seamlessly with any
  71. other internationalised Django applications on your site.
  72. Locales
  73. ~~~~~~~
  74. The locales that are enabled on a site are recorded in the ``Locale`` model in
  75. ``wagtailcore``. This model has just two fields: ID and ``language_code`` which
  76. stores the `BCP-47 language tag <https://en.wikipedia.org/wiki/IETF_language_tag>`_
  77. that represents this locale.
  78. The locale records can be set up with an :ref:`optional management UI <enabling_locale_management>` or created
  79. in the shell. The possible values of the ``language_code`` field are controlled
  80. by the ``WAGTAIL_CONTENT_LANGUAGES`` setting.
  81. .. note:: Read this if you've changed ``LANGUAGE_CODE`` before enabling internationalisation
  82. On initial migration, Wagtail creates a ``Locale`` record for the language that
  83. was set in the ``LANGUAGE_CODE`` setting at the time the migration was run. All
  84. pages will be assigned to this ``Locale`` when Wagtail's internationalisation is disabled.
  85. If you have changed the ``LANGUAGE_CODE`` setting since updating to Wagtail 2.11,
  86. you will need to manually update the record in the ``Locale`` model too before
  87. enabling internationalisation, as your existing content will be assigned to the old code.
  88. Configuration
  89. -------------
  90. In this section, we will go through the minimum configuration required to enable
  91. content to be authored in multiple languages.
  92. .. contents::
  93. :local:
  94. :depth: 1
  95. .. _enabling_internationalisation:
  96. Enabling internationalisation
  97. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  98. To enable internationalisation in both Django and Wagtail, set the following
  99. settings to ``True``:
  100. .. code-block:: python
  101. # my_project/settings.py
  102. USE_I18N = True
  103. WAGTAIL_I18N_ENABLED = True
  104. In addition, you might also want to enable Django's localisation support. This
  105. will make dates and numbers display in the user's local format:
  106. .. code-block:: python
  107. # my_project/settings.py
  108. USE_L10N = True
  109. Configuring available languages
  110. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  111. Next we need to configure the available languages. There are two settings
  112. for this that are each used for different purposes:
  113. - ``LANGUAGES`` - This sets which languages are available on the frontend of the site.
  114. - ``WAGTAIL_CONTENT_LANGUAGES`` - This sets which the languages Wagtail content
  115. can be authored in.
  116. You can set both of these settings to the exact same value. For example, to
  117. enable English, French, and Spanish:
  118. .. code-block:: python
  119. # my_project/settings.py
  120. WAGTAIL_CONTENT_LANGUAGES = LANGUAGES = [
  121. ('en', "English"),
  122. ('fr', "French"),
  123. ('es', "Spanish"),
  124. ]
  125. .. note::
  126. Whenever ``WAGTAIL_CONTENT_LANGUAGES`` is changed, the ``Locale`` model needs
  127. to be updated as well to match.
  128. This can either be done with a data migration or with the optional locale
  129. management UI described in the next section.
  130. You can also set these to different values. You might want to do this if you
  131. want to have some programmatic localisation (like date formatting or currency,
  132. for example) but use the same Wagtail content in multiple regions:
  133. .. code-block:: python
  134. # my_project/settings.py
  135. LANGUAGES = [
  136. ('en-GB', "English (Great Britain)"),
  137. ('en-US', "English (United States)"),
  138. ('en-CA', "English (Canada)"),
  139. ('fr-FR', "French (France)"),
  140. ('fr-CA', "French (Canada)"),
  141. ]
  142. WAGTAIL_CONTENT_LANGUAGES = [
  143. ('en-GB', "English"),
  144. ('fr-FR', "French"),
  145. ]
  146. When configured like this, the site will be available in all the different
  147. locales in the first list, but there will only be two language trees in
  148. Wagtail.
  149. All the ``en-`` locales will use the "English" language tree, and the ``fr-``
  150. locales will use the "French" language tree. The differences between each locale
  151. in a language would be programmatic. For example: which date/number format to
  152. use, and what currency to display prices in.
  153. .. _enabling_locale_management:
  154. Enabling the locale management UI (optional)
  155. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  156. An optional locale management app exists to allow a Wagtail administrator to
  157. set up the locales from the Wagtail admin interface.
  158. To enable it, add ``wagtail.locales`` into ``INSTALLED_APPS``:
  159. .. code-block:: python
  160. # my_project/settings.py
  161. INSTALLED_APPS = [
  162. # ...
  163. 'wagtail.locales',
  164. # ...
  165. ]
  166. Adding a language prefix to URLs
  167. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  168. To allow all of the page trees to be served at the same domain, we need
  169. to add a URL prefix for each language.
  170. To implement this, we can use Django's built-in
  171. `i18n_patterns <https://docs.djangoproject.com/en/3.1/topics/i18n/translation/#language-prefix-in-url-patterns>`_
  172. function, which adds a language prefix to all of the URL patterns passed into it.
  173. This activates the language code specified in the URL and Wagtail takes this into
  174. account when it decides how to route the request.
  175. In your project's ``urls.py`` add Wagtail's core URLs (and any other URLs you
  176. want to be translated) into an ``i18n_patterns`` block:
  177. .. code-block:: python
  178. # /my_project/urls.py
  179. ...
  180. from django.conf.urls.i18n import i18n_patterns
  181. # Non-translatable URLs
  182. # Note: if you are using the Wagtail API or sitemaps,
  183. # these should not be added to `i18n_patterns` either
  184. urlpatterns = [
  185. path('django-admin/', admin.site.urls),
  186. path('admin/', include(wagtailadmin_urls)),
  187. path('documents/', include(wagtaildocs_urls)),
  188. ]
  189. # Translatable URLs
  190. # These will be available under a language code prefix. For example /en/search/
  191. urlpatterns += i18n_patterns(
  192. path('search/', search_views.search, name='search'),
  193. path("", include(wagtail_urls)),
  194. )
  195. User language auto-detection
  196. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  197. After wrapping your URL patterns with ``i18n_patterns``, your site will now
  198. respond on URL prefixes. But now it won't respond on the root path.
  199. To fix this, we need to detect the user's browser language and redirect them
  200. to the best language prefix. The recommended approach to do this is with
  201. Django's ``LocaleMiddleware``:
  202. .. code-block:: python
  203. # my_project/settings.py
  204. MIDDLEWARE = [
  205. # ...
  206. 'django.middleware.locale.LocaleMiddleware',
  207. # ...
  208. ]
  209. Custom routing/language detection
  210. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  211. You don't strictly have to use ``i18n_patterns`` or ``LocaleMiddleware`` for
  212. this and you can write your own logic if you need to.
  213. All Wagtail needs is the language to be activated (using Django's
  214. ``django.utils.translation.activate`` function) before the
  215. ``wagtail.core.views.serve`` view is called.
  216. Recipes for internationalised sites
  217. -----------------------------------
  218. Language/region selector
  219. ^^^^^^^^^^^^^^^^^^^^^^^^
  220. Perhaps the most important bit of internationalisation-related UI you can add
  221. to your site is a selector to allow users to switch between different
  222. languages.
  223. If you're not convinced that you need this, have a look at https://www.w3.org/International/questions/qa-site-conneg#yyyshortcomings for some rationale.
  224. Basic example
  225. ~~~~~~~~~~~~~
  226. Here is a basic example of how to add links between translations of a page.
  227. This example, however, will only include languages defined in
  228. ``WAGTAIL_CONTENT_LANGUAGES`` and not any extra languages that might be defined
  229. in ``LANGUAGES``. For more information on what both of these settings mean, see
  230. `Configuring available languages`_.
  231. If both settings are set to the same value, this example should work well for you,
  232. otherwise skip to the next section that has a more complicated example which takes
  233. this into account.
  234. .. code-block:: html+Django
  235. {# make sure these are at the top of the file #}
  236. {% load i18n wagtailcore_tags %}
  237. {% if page %}
  238. {% for translation in page.get_translations.live %}
  239. {% get_language_info for translation.locale.language_code as lang %}
  240. <a href="{% pageurl translation %}" rel="alternate" hreflang="{{ language_code }}">
  241. {{ lang.name_local }}
  242. </a>
  243. {% endfor %}
  244. {% endif %}
  245. Let's break this down:
  246. .. code-block:: html+Django
  247. {% if page %}
  248. ...
  249. {% endif %}
  250. If this is part of a shared base template it may be used in situations where no page object is available, such as 404 error responses, so check that we have a page before proceeding.
  251. .. code-block:: html+Django
  252. {% for translation in page.get_translations.live %}
  253. ...
  254. {% endfor %}
  255. This ``for`` block iterates through all published translations of the current page.
  256. .. code-block:: html+Django
  257. {% get_language_info for translation.locale.language_code as lang %}
  258. This is a Django built-in tag that gets info about the language of the translation.
  259. For more information, see `get_language_info() in the Django docs <https://docs.djangoproject.com/en/3.1/topics/i18n/translation/#django.utils.translation.get_language_info>`_.
  260. .. code-block:: html+Django
  261. <a href="{% pageurl translation %}" rel="alternate" hreflang="{{ language_code }}">
  262. {{ lang.name_local }}
  263. </a>
  264. This adds a link to the translation. We use ``{{ lang.name_local }}`` to display
  265. the name of the locale in its own language. We also add ``rel`` and ``hreflang``
  266. attributes to the ``<a>`` tag for SEO.
  267. Handling locales that share content
  268. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  269. Rather than iterating over pages, this example iterates over all of the configured
  270. languages and finds the page for each one. This works better than the `Basic example`_
  271. above on sites that have extra Django ``LANGUAGES`` that share the same Wagtail content.
  272. For this example to work, you firstly need to add Django's
  273. `django.template.context_processors.i18n <https://docs.djangoproject.com/en/3.1/ref/templates/api/#django-template-context-processors-i18n>`_
  274. context processor to your ``TEMPLATES`` setting:
  275. .. code-block:: python
  276. # myproject/settings.py
  277. TEMPLATES = [
  278. {
  279. # ...
  280. 'OPTIONS': {
  281. 'context_processors': [
  282. # ...
  283. 'django.template.context_processors.i18n',
  284. ],
  285. },
  286. },
  287. ]
  288. Now for the example itself:
  289. .. code-block:: html+Django
  290. {% for language_code, language_name in LANGUAGES %}
  291. {% get_language_info for language_code as lang %}
  292. {% language language_code %}
  293. <a href="{% pageurl page.localized %}" rel="alternate" hreflang="{{ language_code }}">
  294. {{ lang.name_local }}
  295. </a>
  296. {% endlanguage %}
  297. {% endfor %}
  298. Let's break this down too:
  299. .. code-block:: html+Django
  300. {% for language_code, language_name in LANGUAGES %}
  301. ...
  302. {% endfor %}
  303. This ``for`` block iterates through all of the configured languages on the site.
  304. The ``LANGUAGES`` variable comes from the ``django.template.context_processors.i18n``
  305. context processor.
  306. .. code-block:: html+Django
  307. {% get_language_info for language_code as lang %}
  308. Does exactly the same as the previous example.
  309. .. code-block:: html+Django
  310. {% language language_code %}
  311. ...
  312. {% endlanguage %}
  313. This ``language`` tag comes from Django's ``i18n`` tag library. It changes the
  314. active language for just the code contained within it.
  315. .. code-block:: html+Django
  316. <a href="{% pageurl page.localized %}" rel="alternate" hreflang="{{ language_code }}">
  317. {{ lang.name_local }}
  318. </a>
  319. The only difference with the ``<a>`` tag here from the ``<a>`` tag in the previous example
  320. is how we're getting the page's URL: ``{% pageurl page.localized %}``.
  321. All page instances in Wagtail have a ``.localized`` attribute which fetches the translation
  322. of the page in the current active language. This is why we activated the language previously.
  323. Another difference here is that if the same translated page is shared in two locales, Wagtail
  324. will generate the correct URL for the page based on the current active locale. This is the
  325. key difference between this example and the previous one as the previous one can only get the
  326. URL of the page in its default locale.
  327. API filters for headless sites
  328. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  329. For headless sites, the Wagtail API supports two extra filters for internationalised sites:
  330. - ``?locale=`` Filters pages by the given locale
  331. - ``?translation_of=`` Filters pages to only include translations of the given page ID
  332. For more information, see :ref:`apiv2_i18n_filters`.
  333. Translatable snippets
  334. ^^^^^^^^^^^^^^^^^^^^^
  335. You can make a snippet translatable by making it inherit from ``wagtail.core.models.TranslatableMixin``.
  336. For example:
  337. .. code-block:: python
  338. # myapp/models.py
  339. from django.db import models
  340. from wagtail.core.models import TranslatableMixin
  341. from wagtail.snippets.models import register_snippet
  342. @register_snippet
  343. class Advert(TranslatableMixin, models.Model):
  344. name = models.CharField(max_length=255)
  345. The ``TranslatableMixin`` model adds the ``locale`` and ``translation_key`` fields to the model.
  346. Making snippets with existing data translatable
  347. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  348. For snippets with existing data, it's not possible to just add ``TranslatableMixin``,
  349. make a migration, and run it. This is because the ``locale`` and ``translation_key``
  350. fields are both required and ``translation_key`` needs a unique value for each
  351. instance.
  352. To migrate the existing data properly, we firstly need to use ``BootstrapTranslatableMixin``,
  353. which excludes these constraints, then add a data migration to set the two fields, then
  354. switch to ``TranslatableMixin``.
  355. This is only needed if there are records in the database. So if the model is empty, you can
  356. go straight to adding ``TranslatableMixin`` and skip this.
  357. Step 1: Add ``BootstrapTranslatableMixin`` to the model
  358. *******************************************************
  359. This will add the two fields without any constraints:
  360. .. code-block:: python
  361. # myapp/models.py
  362. from django.db import models
  363. from wagtail.core.models import BootstrapTranslatableMixin
  364. from wagtail.snippets.models import register_snippet
  365. @register_snippet
  366. class Advert(BootstrapTranslatableMixin, models.Model):
  367. name = models.CharField(max_length=255)
  368. # if the model has a Meta class, ensure it inherits from
  369. # BootstrapTranslatableMixin.Meta too
  370. class Meta(BootstrapTranslatableMixin.Meta):
  371. verbose_name = 'adverts'
  372. Run ``python manage.py makemigrations myapp`` to generate the schema migration.
  373. Step 2: Create a data migration
  374. *******************************
  375. Create a data migration with the following command:
  376. .. code-block:: bash
  377. python manage.py makemigrations myapp --empty
  378. This will generate a new empty migration in the app's ``migrations`` folder. Edit
  379. that migration and add a ``BootstrapTranslatableModel`` for each model to bootstrap
  380. in that app:
  381. .. code-block:: python
  382. from django.db import migrations
  383. from wagtail.core.models import BootstrapTranslatableModel
  384. class Migration(migrations.Migration):
  385. dependencies = [
  386. ('myapp', '0002_bootstraptranslations'),
  387. ]
  388. # Add one operation for each model to bootstrap here
  389. # Note: Only include models that are in the same app!
  390. operations = [
  391. BootstrapTranslatableModel('myapp.Advert'),
  392. ]
  393. Repeat this for any other apps that contain a model to be bootstrapped.
  394. Step 3: Change ``BootstrapTranslatableMixin`` to ``TranslatableMixin``
  395. **********************************************************************
  396. Now that we have a migration that fills in the required fields, we can swap out
  397. ``BootstrapTranslatableMixin`` for ``TranslatableMixin`` that has all the
  398. constraints:
  399. .. code-block:: python
  400. # myapp/models.py
  401. from wagtail.core.models import TranslatableMixin # Change this line
  402. @register_snippet
  403. class Advert(TranslatableMixin, models.Model): # Change this line
  404. name = models.CharField(max_length=255)
  405. class Meta(TranslatableMixin.Meta): # Change this line, if present
  406. verbose_name = 'adverts'
  407. Step 4: Run ``makemigrations`` to generate schema migrations, then migrate!
  408. ***************************************************************************
  409. Run ``makemigrations`` to generate the schema migration that adds the
  410. constraints into the database, then run ``migrate`` to run all of the
  411. migrations:
  412. .. code-block:: bash
  413. python manage.py makemigrations myapp
  414. python manage.py migrate
  415. When prompted to select a fix for the nullable field 'locale' being changed to
  416. non-nullable, select the option "Ignore for now" (as this has been handled by the
  417. data migration).
  418. Translation workflow
  419. --------------------
  420. As mentioned at the beginning, Wagtail does supply ``wagtail.contrib.simple_translation``.
  421. The simple_translation module provides a user interface that allows users to copy pages and translatable snippets into another language.
  422. - Copies are created in the source language (not translated)
  423. - Copies of pages are in draft status
  424. Content editors need to translate the content and publish the pages.
  425. To enable add ``"wagtail.contrib.simple_translation"`` to ``INSTALLED_APPS``
  426. and run ``python manage.py migrate`` to create the ``submit_translation`` permissions.
  427. In the Wagtail admin, go to settings and give some users or groups the "Can submit translations" permission.
  428. .. note::
  429. Simple Translation is optional. It can be switched out by third-party packages. Like the more advanced `wagtail-localize <https://github.com/wagtail/wagtail-localize>`_.
  430. Wagtail Localize
  431. ^^^^^^^^^^^^^^^^
  432. As part of the initial work on implementing internationalisation for Wagtail core,
  433. we also created a translation package called ``wagtail-localize``. This supports
  434. translating pages within Wagtail, using PO files, machine translation, and external
  435. integration with translation services.
  436. Github: https://github.com/wagtail/wagtail-localize
  437. Alternative internationalisation plugins
  438. ========================================
  439. Before official multi-language support was added into Wagtail, site implementors
  440. had to use external plugins. These have not been replaced by Wagtail's own
  441. implementation as they use slightly different approaches, one of them might
  442. fit your use case better:
  443. - `Wagtailtrans <https://github.com/wagtail/wagtailtrans>`_
  444. - `wagtail-modeltranslation <https://github.com/infoportugal/wagtail-modeltranslation>`_
  445. For a comparison of these options, see AccordBox's blog post
  446. `How to support multi-language in Wagtail CMS <https://www.accordbox.com/blog/how-support-multi-language-wagtail-cms/>`_.
  447. Wagtail admin translations
  448. ==========================
  449. The Wagtail admin backend has been translated into many different languages. You can find a list of currently available translations on Wagtail's `Transifex page <https://www.transifex.com/torchbox/wagtail/>`_. (Note: if you're using an old version of Wagtail, this page may not accurately reflect what languages you have available).
  450. If your language isn't listed on that page, you can easily contribute new languages or correct mistakes. Sign up and submit changes to `Transifex <https://www.transifex.com/torchbox/wagtail/>`_. Translation updates are typically merged into an official release within one month of being submitted.
  451. Change Wagtail admin language on a per-user basis
  452. =================================================
  453. Logged-in users can set their preferred language from ``/admin/account/``.
  454. By default, Wagtail provides a list of languages that have a >= 90% translation coverage.
  455. It is possible to override this list via the :ref:`WAGTAILADMIN_PERMITTED_LANGUAGES <WAGTAILADMIN_PERMITTED_LANGUAGES>` setting.
  456. In case there is zero or one language permitted, the form will be hidden.
  457. If there is no language selected by the user, the ``LANGUAGE_CODE`` will be used.
  458. Changing the primary language of your Wagtail installation
  459. ==========================================================
  460. The default language of Wagtail is ``en-us`` (American English). You can change this by tweaking a couple of Django settings:
  461. - Make sure `USE_I18N <https://docs.djangoproject.com/en/stable/ref/settings/#use-i18n>`_ is set to ``True``
  462. - Set `LANGUAGE_CODE <https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-LANGUAGE_CODE>`_ to your websites' primary language
  463. If there is a translation available for your language, the Wagtail admin backend should now be in the language you've chosen.