Skip to content

Commit 8db5671

Browse files
committed
IMPROVEMENT: automate the extraction and update of the .pot file
1 parent a986bd7 commit 8db5671

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

.github/workflows/i18n-extract.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Extract i18n Strings
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- '**/*.py'
9+
- '!**/tests/**'
10+
11+
jobs:
12+
extract_strings:
13+
runs-on: ubuntu-latest
14+
env:
15+
PYGETTEXT_DOMAIN: 'ardupilot_methodic_configurator'
16+
PYGETTEXT_LOCALEDIR: '${PYGETTEXT_DOMAIN}/locale'
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.x'
25+
26+
- name: Install requirements
27+
run: |
28+
python -m pip install --upgrade pip python-gettext
29+
30+
- name: Extract strings
31+
run: |
32+
pygettext3 -d ${PYGETTEXT_DOMAIN} -o ${PYGETTEXT_LOCALEDIR}/${PYGETTEXT_DOMAIN}.pot $(git ls-files '*.py')
33+
34+
- name: Commit changes
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
run: |
38+
git config user.email "[email protected]"
39+
git config user.name "GitHub Actions"
40+
git add ${PYGETTEXT_LOCALEDIR}/${PYGETTEXT_DOMAIN}.pot
41+
if [ -n "$(git status --porcelain)" ]; then
42+
git commit -m "Extracted i18n strings"
43+
git push
44+
else
45+
echo "No changes to commit"
46+
fi

ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ def __on_parameter_add(self, fc_parameters: dict[str, float]) -> None:
538538
add_parameter_window.root.geometry("450x300")
539539

540540
# Label for instruction
541-
instruction_label = ttk.Label(add_parameter_window.main_frame, text=_(_("Enter the parameter name to add:")))
541+
instruction_label = ttk.Label(add_parameter_window.main_frame, text=_("Enter the parameter name to add:"))
542542
instruction_label.pack(pady=5)
543543

544544
param_dict = self.local_filesystem.doc_dict or fc_parameters

0 commit comments

Comments
 (0)