Sync locale catalogs and wire GDPR settings to authenticated APIs - #935
Merged
Conversation
- Add a CI-enforced locale parity check (scripts/check-locale-parity.mjs, wired into reusable-test.yml) that fails on keys missing relative to en.json, and fixes the drift it found: adds app.footer.tagline to ar/de/fr/hi/pt/zh, and the missing base/`_plural` time/offline/rateLimit keys in ru.json. - Replace leaked "Wata-Board" (and its Arabic transliteration) product-name placeholder with "PetChain" across all 10 locale catalogs. - Log a dev-only, de-duplicated console warning whenever the i18n `t()` helper falls back to English, to surface future catalog gaps early. - Rework src/lib/gdpr.ts into an authenticated axios client (matching the twoFactorAPI/userAPI pattern: bearer token interceptor, withCredentials) instead of unauthenticated `fetch` calls proxied through insecure src/pages/api/gdpr/* routes (removed, now unused). - useGdpr now loads and persists deletion-request status across reloads, tracks a single `pendingAction` to block duplicate export/deletion/cancel submissions, adds `cancelDeletion`, and surfaces 401/403/server error messages distinctly. - GdprSettings shows the current erasure-request status (pending/ processing/completed/failed/cancelled), swaps the request button for a cancel action while a request is active, and disables actions only while that specific action is in flight. Closes DogStark#889, closes DogStark#886. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
@yosemite01 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
#889 — Keep locale catalogs structurally synchronized
scripts/check-locale-parity.mjs(npm runcheck:locales, wired intoreusable-test.yml) which fails CI when a locale undersrc/i18n/localesis missing keys present inen.json(the source of truth). Extra keys (e.g. Russian's CLDR_one/_few/_manyplural forms) are reported as warnings only, since those are legitimate additions, not drift.app.footer.taglinekey toar,de,fr,hi,pt,zh, and the missing base/_pluralkeys fortime.*,offline.queue.description,offline.status.queueStatus, andpayment.rateLimit.requestsAvailableinru.json(using the existing Russian "many" plural form, which was already correctly translated under a different key).en.json) referenced the placeholder brand "Wata-Board" (and, in Arabic, its transliteration "واتا-بورد") instead of "PetChain". Replaced all 50 occurrences across all 10 locales.t()insrc/i18n/index.tsxnow logs a de-duplicated, dev-only console warning whenever it falls back to English for a key missing in the active locale, so future gaps surface during development instead of silently degrading.#886 — Complete GDPR settings integration with authenticated APIs
src/lib/gdpr.tspreviously calledfetch()directly against/api/gdpr/*, which proxied to the backend (src/pages/api/gdpr/*) without forwarding any auth token or cookies — any request could read/mutate GDPR data for an arbitraryuserId. Rewrote it as an axios-based client following the same pattern already used bytwoFactorAPI/userAPI(bearer token interceptor reading fromlocalStorage,withCredentials: true), hitting the backend directly. Removed the now-unused, insecure proxy routes undersrc/pages/api/gdpr/.useGdprnow also fetches and stores deletion-request status on load, so a pending/processing erasure request is correctly reflected after a page reload instead of resetting.pendingActionstate touseGdprso export / request-deletion / cancel-deletion can't be double-submitted while one is already in flight, and addedcancelDeletion.GdprSettingsnow surfaces the current erasure-request status (pending/processing/completed/failed/cancelled) and swaps the "Request Account Erasure" button for a "Cancel Erasure Request" action while a request is active, rather than only ever offering a fresh request.TODO / not fully covered
/gdpr/users/:userId/...) are inferred from the previous Next.js proxy routes; adjustsrc/lib/gdpr.tsif the real backend contract differs.hi.jsonand a few other locales still contain literal English copy in places beyond the brand-name fix (pre-existing translation-quality gap, not structural — out of scope here).Test plan
node scripts/check-locale-parity.mjsexits 0 with no missing keys across all locales.Closes #889
Closes #886