From a074ea70e94ce1e7e938979b62fbb905e99aac41 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 18 Apr 2021 17:31:15 +0200 Subject: [PATCH] website/docs-dev: add initial translation docs Signed-off-by: Jens Langhammer --- website/developer-docs/translation.md | 29 +++++++++++++++++++++++++++ website/sidebarsDev.js | 4 ++++ 2 files changed, 33 insertions(+) create mode 100644 website/developer-docs/translation.md diff --git a/website/developer-docs/translation.md b/website/developer-docs/translation.md new file mode 100644 index 000000000..623a2aec4 --- /dev/null +++ b/website/developer-docs/translation.md @@ -0,0 +1,29 @@ +--- +title: Translation +--- + +Translation in authentik is done in two places. Most of the text is defined in the frontend in `web/`, and a subset of messages is defined in the backend. + +The frontend uses [lingui](https://lingui.js.org/), and the backend uses the built-in django translation tools. + +## Frontend + +If you want to translate the frontend to a new language, ensure the language code is in the `package.json` file in `web/`: + +```json + // [...] + "lingui": { + // [...] + "locales": [ + "en", + "pseudo-LOCALE", + "a-new-locale" + ], + // [...] +``` + +Afterwards, run `npx lingui extract` to generate a base .po file. + +The .po files can be edited by any text editor, or using a tool such as [POEdit](https://poedit.net/). + +To see the change, run `npm run watch` in the `web/` directory. diff --git a/website/sidebarsDev.js b/website/sidebarsDev.js index 301d1228a..fb8b51395 100644 --- a/website/sidebarsDev.js +++ b/website/sidebarsDev.js @@ -8,5 +8,9 @@ module.exports = { type: "doc", id: "api", }, + { + type: "doc", + id: "translation", + }, ], };