Skip to content

Commit

Permalink
chore: move babel configuration to pyproject.toml
Browse files Browse the repository at this point in the history
This commit removes the default Babel CLI's configuration file by moving them into the `pyproject.toml`
  • Loading branch information
zobweyt committed Oct 6, 2024
1 parent 8d92663 commit 4685a55
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ You can find a complete list of all supported locales [here](src/i18n/locales).
We have three main i18n scripts defined in [`pyproject.toml`](pyproject.toml) that leverage [Babel's CLI](https://babel.pocoo.org) to manipulate translation messages:

- **Extract**: Creates `messages.pot` (Portable Object Template) from files defined in [`babel.ini`](babel.ini):
- **Extract**: Creates `messages.pot` (Portable Object Template) using methods defined in [`pyproject.toml`](pyproject.toml):
```sh
pdm i18n:extract
```
Expand Down
5 changes: 0 additions & 5 deletions babel.ini

This file was deleted.

17 changes: 16 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dev = [
"check" = "ruff check"
"format" = "ruff format"
"i18n:update" = "pybabel update -w 120 -D messages -i 'src\\i18n\\locales\\messages.pot' -d 'src\\i18n\\locales'"
"i18n:extract" = "pybabel extract -w 120 -F babel.ini -o 'src\\i18n\\locales\\messages.pot' ."
"i18n:extract" = "pybabel extract -w 120 -F pyproject.toml -o 'src\\i18n\\locales\\messages.pot' ."
"i18n:compile" = "pybabel compile -f -D messages -d 'src\\i18n\\locales' --statistics"


Expand All @@ -51,3 +51,18 @@ select = [
"F", # Pyflakes
"I", # isort
]


[[tool.babel.mappings]]
method = "jinja2"
pattern = "**.jinja"


[[tool.babel.mappings]]
method = "python"
pattern = "**.py"


[[tool.babel.mappings]]
method = "ignore"
pattern = ["**/tests/**", "**/migrations/**"]
2 changes: 1 addition & 1 deletion src/i18n/locales/en/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-09-28 20:17+0300\n"
"POT-Creation-Date: 2024-10-06 15:45+0300\n"
"PO-Revision-Date: 2024-09-08 21:28+0300\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en\n"
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/ru/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-09-28 20:17+0300\n"
"POT-Creation-Date: 2024-10-06 15:45+0300\n"
"PO-Revision-Date: 2024-09-08 21:28+0300\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: ru\n"
Expand Down

0 comments on commit 4685a55

Please sign in to comment.