Skip to content

v0.4.0.1: restore Vietnamese translations, fix daisyUI modals under Unfold - #23

Merged
tanhtm merged 1 commit into
main2.0from
feat/daisyui-multi-theme
Oct 14, 2026
Merged

tanhtm merged 1 commit into
main2.0from
feat/daisyui-multi-theme

Conversation

@tanhtm

@tanhtm tanhtm commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Patch release for the issues the dev team reported against v0.4.0.0, plus everything of the same kind found by a systematic sweep.

1. Translations dropped in 0.4.0.0

makemessages can't read _() inside f-strings. When the catalog was regenerated for 0.4.0.0, the strings used only that way became obsolete (#~), were left out of django.mo, and showed in English. The report named two of them; the sweep found eight:

String Where
Inactive, Admin, Bot user grid badges and role icons
has been updated by user title of every update notification
added, removed M2M change notes
progress from last, in dashboard KPI cards

How the sweep worked:

  • Every obsolete catalog entry still referenced in code was checked.
  • An AST scan found all gettext calls inside f-strings (23 calls).
  • Every literal msgid was checked against the runtime vi translation.

The fix:

  • The _() calls are moved out of the f-strings and the translations restored by msgmerge.
  • Translation corrections:
    • "Admin" (role badge) is now "Quản trị"; it used to read "Trang quản trị", which means "admin site".
    • "Bot" stays "Bot" instead of "Máy".
  • Dashboard KPI cards use whole sentences with placeholders: %(object)s in %(period)s → "Hoạt động trong tuần", and %(count)s successful (%(rate)s%%).
  • Strings that were hard-coded in English are translated:
    • "day" and "successful";
    • notification bodies ("… has been updated by user … with the following changes"), already English in 0.3.x.
  • Small fixes in the same code: no change shows as a green +0 (not a red -0), and the color classes are literal.

2. ui-modal overridden by Unfold's dialog rule

Unfold styles every <dialog> with an unlayered rule (width: container-md, translate: -50% -50%, white background, padding). Unlayered CSS beats daisyUI's layered .ui-modal regardless of specificity. As a result, an open modal was a 448px white column with no overlay: the announcement dialog, the feedback "resolve" dialogs and the markdown preview.

The fix:

  • A dialog.ui-modal rule restores the full-screen modal and its dimmed overlay, and drops Unfold's blurred ::backdrop.
  • The sweep listed every unlayered Unfold rule. dialog is the only one on a bare element. The others are scoped to Unfold's own widgets (calendar, jsoneditor, selector), and none touches the daisyUI components the package uses.

3. /announcement/ returned a 500

  • The endpoint raised a 500 when the project-provided ANNOUNCEMENT_CONTENT_HTML_FILE template is missing.
  • It returned None when the setting is empty.
  • Both cases now return empty content, and a missing template logs a warning.

Version

0.4.0.1, with CHANGELOG / README entries and docs/reports/releases/2026-10-14-v0.4.0.1.md. No migrations.

Tests

New tests, each failing on v0.4.0.0:

  • no gettext call inside an f-string;
  • every literal msgid in the package's Python code is in the compiled vi catalog (this catches future makemessages drops);
  • the dashboard KPI card is translated;
  • styles.css carries the dialog.ui-modal override;
  • /announcement/ without a template and with an empty setting.

Validation

  • 48 tests pass, under the test project and the package's own settings.
  • check is clean and makemigrations --check reports no changes.
  • msgfmt --check passes; no untranslated or fuzzy entries.
  • Rebuilding the CSS and recompiling the .mo leave no diff.
  • Chromium, Vietnamese UI:
    • KPI cards read "Hoạt động trong hôm nay · 21 thành công (87.5%) · tiến trình từ lần cuối - ngày";
    • the announcement modal is a full-screen overlay in light and dark, Esc closes it, and it takes no space when closed.

After merge

Create a GitHub Release v0.4.0.1 on main2.0. PyPI and the Docker base images (v0.4.0.1) are published by the workflows.

… Unfold

- i18n: _() calls inside f-strings are invisible to makemessages, so
  regenerating the catalog for 0.4.0.0 made 8 strings obsolete and they
  showed in English (user badges Inactive/Admin/Bot, 'has been updated
  by user' in every update notification, M2M added/removed, dashboard
  'progress from last'/'in'). Calls moved out of the f-strings,
  translations restored; dashboard KPI uses whole sentences with named
  placeholders, 'day'/'successful' and notification bodies ('with the
  following changes') are translated; +0 instead of a red -0; literal
  color classes.
- Modals: Unfold's unlayered dialog{} rule beats daisyUI's layered
  .ui-modal, so an open ui-modal was a narrow white column with no
  overlay (announcement, feedback resolve, markdown preview).
  dialog.ui-modal restores the full-screen modal. It is the only
  unlayered Unfold rule on a bare element.
- /announcement/: empty content (and a warning) instead of a 500 when
  the project template is missing or the setting is empty.
- Tests: no gettext inside f-strings; every literal msgid in Python code
  is in the compiled vi catalog; KPI translated; modal CSS override;
  announcement endpoint. All fail on 0.4.0.0.
- Version 0.4.0.1, CHANGELOG / README / release notes.
@tanhtm
tanhtm merged commit 43cca70 into main2.0 Oct 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant