Skip to content

Commit c9568b0

Browse files
committed
add a note to the README about how to add translations
1 parent 031926c commit c9568b0

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,31 @@ print(f"{stats['manually_translated']} segments manually translated")
137137
- Wagtail 5.2+
138138
- wagtail-localize 1.8+
139139

140+
## Internationalization (i18n)
141+
142+
The plugin UI is translatable. Django will automatically select the right language based on the user's browser settings (requires `django.middleware.locale.LocaleMiddleware` in your `MIDDLEWARE`).
143+
144+
### Adding a new language
145+
146+
1. From the `wagtail_localize_intentional_blanks` directory, generate a `.po` file for the new locale:
147+
148+
```bash
149+
cd wagtail_localize_intentional_blanks
150+
django-admin makemessages -l <language_code> --no-wrap
151+
```
152+
153+
2. Edit `locale/<language_code>/LC_MESSAGES/django.po` and fill in the `msgstr` values.
154+
155+
3. Compile the translations:
156+
157+
```bash
158+
django-admin compilemessages -l <language_code>
159+
```
160+
161+
4. Submit a pull request with both the `.po` and `.mo` files.
162+
163+
For more details, see Django's [translation documentation](https://docs.djangoproject.com/en/stable/topics/i18n/translation/).
164+
140165
## Release
141166

142167
In order to make a release, we add a git tag and push it to GitHub. We have a GitHub Action that releases the code to PyPI when we add a new tag.

0 commit comments

Comments
 (0)