feat(showcase): i18n_demo app — LocaleMiddleware + URL-prefix (Phase 5)#527
Open
ujeenet wants to merge 3 commits into
Open
feat(showcase): i18n_demo app — LocaleMiddleware + URL-prefix (Phase 5)#527ujeenet wants to merge 3 commits into
ujeenet wants to merge 3 commits into
Conversation
… (Phase 5)
Adds the i18n_demo sub-app exercising:
- LocaleMiddleware cookie / Accept-Language pick order:
cookie > Accept-Language > configured default
- Documented Router::nest("/<lang>", router.layer(LocaleMiddleware::new(\&[lang])))
pattern for URL-prefix locales — same shape as Django's
i18n_patterns
- Per-locale greeting handler that reads ActiveLocale from the
request extensions
## Routes
GET /i18n/greeting — cookie/header-driven
GET /<lang>/i18n/greeting — URL-prefix-pinned (en/fr/es)
## Playwright
9 new tests under e2e/tests/i18n_demo/:
- default → en
- Accept-Language matches available locale
- Accept-Language no-match → default
- cookie overrides Accept-Language
- unknown cookie value falls through to Accept-Language
- URL prefix overrides headers (fr / es / en)
- unknown locale prefix → 404
Suite is now 32/32 passing locally (2 smoke + 5 blog + 6 shop +
10 accounts + 9 i18n_demo).
ujeenet/rustango-cms#260) The bare admin's `AdminError::TableMissing` variant rendered a friendly "run migrations" page when the underlying SQL table was absent — but only for Postgres. The detection lived inside `pg_undefined_table_error`, which matched PG SQLSTATE `42P01`. On sqlite and mysql the error flowed through `AdminError::Internal` and surfaced as a 500 with a correlation id and an opaque "internal server error" body. Anyone clicking around the auto-generated admin sidebar after a fresh tenant provisioning on a non-PG build hit this. Add dialect-specific parsers: - `sqlite_undefined_table_error` matches sqlx's message prefix `no such table: <name>` and extracts the identifier. - `mysql_undefined_table_error` matches MySQL error code 1146 (`ER_NO_SUCH_TABLE`) and pulls the unqualified name out of the `Table 'db.name' doesn't exist` message shape. - New `undefined_table_error` umbrella tries PG → sqlite → mysql in order; the two `From` impls (`sqlx::Error` and `ExecError`) now call the umbrella so every entry point gets parity. Two unit tests pin the sqlite + mysql message-shape parsing. The friendly HTML page and its existing test are unchanged — same URL surface, same response shape, just reached on more backends.
…owcase-phase5-i18n
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 5 of the E2E showcase plan. Adds the `i18n_demo` sub-app exercising:
Routes
Playwright
9 new tests under `e2e/tests/i18n_demo/`:
Suite is now 32/32 passing locally (2 smoke + 5 blog + 6 shop + 10 accounts + 9 i18n_demo).
CI matrix
Same shape — runs the 32 tests against postgres / mysql / sqlite per matrix row.