Admin panel in English and Polish, reworded per docs/dev/admin-ux.md
- admin-i18n module: AdminText { en, pl }, component texts under the ipal
namespace (project translations win), en + pl admin languages when the
project sets none (project's supportedLanguages wins)
- every plugin label, description, option, tab and group as { en, pl };
explicit labels instead of auto-labels; sentence case; glossary terms
- visible renames (slugs, names, data unchanged): Cookie banner, Form
messages, Privacy group, Search engines, Maintenance, Spam protection,
E-mail sending, stats nav link Overview (hidden without access)
- Polish visitor defaults by page locale: cookie banner, form messages,
validators, lightbox, accessibility widget; {field} uses the label
- fixes: e-mail status banner used Turnstile wording; developer words and
env var names out of editor messages; stats numbers/dates in the admin
language; test e-mail no longer says ipal-kit
- test/adminUx.test.ts: length limits, en + pl present, no developer words
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
eeac33ed2f
commit
6b46bc0c14
@@ -26,7 +26,10 @@ export type Validator<T> = (values: T) => FormErrors<T>
|
||||
type UseFormOptions<T extends Record<string, unknown>> = {
|
||||
/** Clear a field's error as soon as the user edits it. Default true. */
|
||||
clearErrorOnChange?: boolean
|
||||
/** Generic error message shown when the action fails/throws with no message. */
|
||||
/**
|
||||
* Generic error shown when the action fails or throws without a message.
|
||||
* Pass one in the page's language (e.g. getNotificationTexts(...).form.error).
|
||||
*/
|
||||
errorFallback?: string
|
||||
/** Defines the field set AND the reset state. Any shape you like. */
|
||||
initialValues: T
|
||||
@@ -73,7 +76,7 @@ type UseFormOptions<T extends Record<string, unknown>> = {
|
||||
export function useForm<T extends Record<string, unknown>>(options: UseFormOptions<T>) {
|
||||
const {
|
||||
clearErrorOnChange = true,
|
||||
errorFallback = 'Something went wrong. Please try again.',
|
||||
errorFallback = 'The form could not be sent. Please try again in a moment.',
|
||||
initialValues,
|
||||
requireTurnstile = false,
|
||||
submitAction,
|
||||
@@ -144,8 +147,9 @@ export function useForm<T extends Record<string, unknown>>(options: UseFormOptio
|
||||
} else {
|
||||
setErrorMessage(result.message || errorFallback)
|
||||
}
|
||||
} catch (err) {
|
||||
setErrorMessage(err instanceof Error ? err.message : errorFallback)
|
||||
} catch {
|
||||
// Never show the thrown error's text to a visitor — it can carry server internals.
|
||||
setErrorMessage(errorFallback)
|
||||
} finally {
|
||||
setIsSubmitting(false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user