Skip to content

refactor(web): move login form copy into ui-config/strings - #896

Open
RafaelJaime wants to merge 1 commit into
codelitdev:mainfrom
RafaelJaime:refactor/login-strings
Open

RafaelJaime wants to merge 1 commit into
codelitdev:mainfrom
RafaelJaime:refactor/login-strings

Conversation

@RafaelJaime

Copy link
Copy Markdown

The login page and the checkout login form take most of their copy from ui-config/strings.ts, but a few visible texts were still hardcoded in the components: the email and code placeholders, the "Terms" link label, the checkout form's validation messages and the reCAPTCHA / sign-in error toasts.

This moves every one of them into ui-config/strings.ts with the same English values, so nothing changes for users. It makes both login forms translatable from one file, which is what self-hosters running CourseLit in another language currently have to patch by hand (related: #508, #711). It does not add an i18n layer.

  • apps/web/app/(with-contexts)/(with-layout)/login/login-form.tsx: placeholders, Terms label, sign-in error and reCAPTCHA messages.
  • apps/web/components/public/payments/login-form.tsx: placeholders, Terms label, zod validation messages and reCAPTCHA messages.
  • apps/web/ui-config/strings.ts: the new constants (LOGIN_*, CHECKOUT_LOGIN_*, RECAPTCHA_*). The reCAPTCHA score message keeps its exact output.

Tests: a new login/__tests__/login-form.test.tsx and a new case in payments/__tests__/login-form.test.tsx check that the email step renders its placeholder and Terms link from the constants. Both failed before the change and pass now. Full pnpm test: 101 suites, 837 tests pass; eslint adds no warnings; prettier applied.

The login page and the checkout login form hardcoded their placeholders,
the Terms link label, validation messages and error toasts, while the rest
of their copy already came from ui-config/strings.ts. Every visible text of
both forms now lives there, with the same English values, so the UI reads
the same and a fork or a future i18n layer can translate the forms in one
place.

This branch has not been deployed

No deployments
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