i18n String Field

i18n String Field is a copy-paste React component that stops translation drops a placeholder before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/i18n-string-field
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsTranslation drops a placeholder

Was this component page useful?

How do I install i18n String Field?

pnpm dlx shadcn@latest add @bollard/i18n-string-field

The files land in your project. They're yours to edit.

How do I use i18n String Field in React?

i18n-string-field-usage.tsx
import { I18nStringField } from "@/components/ui/i18n-string-field"

<I18nStringField
  locale="pl"
  source="{count, plural, one {<b>#</b> file shared with {name}} other {<b>#</b> files shared with {name}}}"
  defaultValue="{count, plural, one {<b>#</b> plik dla {imie}} other {<b>#</b> plików dla {imie}}}"
  rows={3}
/>

What input mistakes does i18n String Field catch?

  • Placeholders dropped or renamed ({count}, %s, %1$s, {{name}})
  • Markup tags missing or left unclosed
  • ICU plural branches the target language needs (via Intl.PluralRules)
  • Translation longer than the UI budget
  • Source text pasted back untranslated

What props does i18n String Field accept?

I18nStringField props
PropTypeDefault
source* (required)

The source string, e.g. the English original.

string—
locale* (required)

Target locale (BCP 47), used for plural rules and the label.

string—
sourceLocale

Locale of the source string.

string"en"
maxLength

UI budget in rendered characters (tags don't count, placeholders count as `placeholderLength`).

number—
placeholderLength

Width a placeholder is assumed to render at.

number4
value

Controlled translation.

string—
defaultValue

Initial translation when uncontrolled.

string""
onValueChange

Called with the translation on every change.

(value: string) => void—
label

Visible label. `{language}` is filled in.

string"Translation · {language}"
sourceLabel

Label shown above the source string.

string"Source"
keepSameLabel

Accessible label of the button that accepts a translation identical to the source.

string"It's meant to match the source"

* required. Also accepts the native props of <textarea> (className, aria-*, data-*…), passed through to it.

How is i18n String Field accessible?

  • Visible label tied to the field, described by the issues list
  • Issues list is a polite live region
  • Placeholder chips have aria-labels saying present or missing
  • Keep-same button has an aria-label and title

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Plural rules come from the browser's Intl.PluralRules data, which can lag CLDR
  • Rendered length is a character estimate, not measured pixel width
  • Doesn't judge translation quality or meaning

What expensive mistakes does i18n String Field stop?

Translation drops a placeholder

Also known as

i18n · l10n · translation · localization · placeholders · icu plural · locale · hindi

Field type

What dependencies does i18n String Field require?

i18n String Field facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component namei18n String Field
Registry identifier@bollard/i18n-string-field
Install commandnpx shadcn@latest add @bollard/i18n-string-field
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about i18n String Field

What form validation mistake does i18n String Field catch?

i18n String Field prevents translation drops a placeholder. Checks each translation against its source as it is typed, so dropped placeholders, broken tags or missing plural forms don't ship. Catches: Placeholders dropped or renamed ({count}, %s, %1$s, {{name}}), Markup tags missing or left unclosed, ICU plural branches the target language needs (via Intl.PluralRules), Translation longer than the UI budget, Source text pasted back untranslated. Limitation: validate i18n-string-field schemas on backend.

How do I install i18n-string-field with shadcn?

Run `npx shadcn@latest add @bollard/i18n-string-field`. Sources added: registry/default/i18n-string-field/i18n-checks.ts, registry/default/i18n-string-field/i18n-string-field.tsx. Package requirements: lucide-react.

What props customize i18n String Field?

i18n String Field accepts `source`, `locale`, `sourceLocale`, `maxLength`, `placeholderLength`. Configures i18n, l10n, translation behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of i18n-string-field?

Plural rules come from the browser's Intl.PluralRules data, which can lag CLDR. Rendered length is a character estimate, not measured pixel width. Doesn't judge translation quality or meaning Server requirement: backend verification for i18n-string-field.

How does i18n String Field meet accessibility guidelines?

Visible label tied to the field, described by the issues list. Issues list is a polite live region. Placeholder chips have aria-labels saying present or missing. Keep-same button has an aria-label and title. Minimizes errors: translation missing placeholder, icu plural wrong.

Which components pair with i18n String Field?