Skip to content

Commit 77ce8a6

Browse files
README instructions
1 parent fdbd108 commit 77ce8a6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,30 @@ After setting up your development environment you may run tests.
251251
python manage.py test django_ledger
252252
```
253253

254+
# Adding new localization
255+
256+
1. Choose the desired locale in the form `ll` or `ll_CC` as described in the [official Django documentation](https://docs.djangoproject.com/en/5.2/topics/i18n/#term-locale-name). For example, to translate to `Spanish (Mexico)`, your string would be `es_MX`. To translate to `French`, you choose `fr`.
257+
2. Generate the *.po file containing all the strings that need translation for your selected locale using the command `django-admin makemessages -l <ll|ll_CC>`. Examples:
258+
259+
```bash
260+
$ django-admin makemessages -l es_MX
261+
$ django-admin makemessages -l fr
262+
```
263+
3. Open your generated file: `locale/<ll|ll_CC>/LC_MESSAGES/django.po` and add your translations inside the `msgstr` placeholders.
264+
4. Compile the messages using:
265+
```bash
266+
$ django-admin compilemessages
267+
```
268+
5. Open the `dev_env/settings.py` file and change `LANGUAGE_CODE` to your new language code. It's in the format `ll-cc` or `ll`, as described in the [official Django documentation](https://docs.djangoproject.com/en/5.2/topics/i18n/#term-language-code). Examples:
269+
```python
270+
LANGUAGE_CODE = 'es-mx'
271+
```
272+
or
273+
```python
274+
LANGUAGE_CODE = 'fr'
275+
```
276+
6. Run the server with `python manage.py runserver`. Your strings should show up in your selected locale and language.
277+
254278
# Screenshots
255279
256280
![django ledger entity dashboard](https://us-east-1.linodeobjects.com/django-ledger/public/img/django_ledger_entity_dashboard.png)

0 commit comments

Comments
 (0)