Localize

From aladicf/better-web-ui · View interactive version

Localize is an AI agent skill from the GitHub repository aladicf/better-web-ui. Plan, implement, or improve an internationalization and localization strategy for UI content, formatting, and regional adaptation. Use when the user asks to add i18n, localize, translate, support multiple languages, handle regional formats, manage locale switching, or build a multilingual product.

How to use this skill

Skill file

Build and maintain internationalized interfaces that feel native in every supported locale, not merely translated.

Localization is more than swapping strings. It is adapting layout, formatting, content, and interaction patterns so that users in every market experience the product as intentional, not as an afterthought.

Consult the language and locale selection reference when designing language selectors, country pickers, currency choosers, or regional-preference controls.

Consult the component accessibility reference when localizing custom components that must remain keyboard-navigable and screen-reader friendly across locales.

Consult the error-recovery reference when localizing validation messages, error states, and recovery flows.

Consult the date-input-ux and date-time-picker-ux references when adapting date, time, and calendar patterns to locale conventions.

MANDATORY PREPARATION

Users start this workflow with /localize. Once this skill is active, load $frontend-design — it contains design principles, anti-patterns, and the Context Gathering Protocol. Follow that protocol before proceeding — if no design context exists yet, you MUST load $setup first. Additionally gather: which markets and languages are targeted now and next, whether the product is content-heavy or UI-heavy, and whether translation will be done in-house, by agency, or through a TMS.

Assess Localization Scope

Understand what must change and how deep the adaptation goes:

  1. Content surface area:
  1. Formatting and conventions:
  1. Layout and structural adaptation:
  1. Content and legal differences:

Localization Architecture

String Management Strategy

Key-based extraction:

Message format:

// Good: complete sentence with interpolation
{count, plural, =0 {No items} one {# item} other {# items}} in your cart

// Bad: concatenated fragments
t('items_prefix') + count + t('items_suffix')

Source language discipline:

Locale Negotiation and Routing

URL strategy (choose one and commit):

Locale detection order:

  1. Explicit user preference (stored in account or cookie)
  2. URL path or subdomain
  3. Browser Accept-Language header
  4. Geolocation (use as soft default only, never hard redirect)

Locale persistence:

Library and Tool Selection

| Need | Strong options | When to use |

|------|----------------|-------------|

| React / modern frameworks | react-i18next, Lingui, FormatJS (react-intl) | Component-level translations with hooks/context |

| Vue | vue-i18n | Vue 2/3 with composition or options API |

| Svelte | svelte-i18n, typesafe-i18n | Lightweight, store-based reactivity |

| Vanilla JS / framework-agnostic | i18next, FormatJS IntlMessageFormat | Shared across stacks, extensive plugin ecosystem |

| Build-time extraction | Lingui, typesafe-i18n | Smaller bundles, no runtime parsing |

| Runtime extraction | i18next, react-i18next | Dynamic loading, CMS-driven content |

| Translation management | Phrase, Lokalise, Crowdin, Smartling | Team collaboration, TMS workflows, in-context editing |

Pragmatic rules:

Implementation Dimensions

Text Expansion and Layout Resilience

Space budget:

Container behavior:

RTL and Bidirectional Text

CSS logical properties:

/* Use logical properties for margins, padding, borders */
margin-inline-start: 1rem;
padding-inline: 1rem;
border-inline-end: 1px solid;

Direction-aware transforms:

[dir="rtl"] .arrow { transform: scaleX(-1); }
[dir="rtl"] .timeline { flex-direction: row-reverse; }

Mirroring considerations:

Formatting and Data Display

Dates and times:

Numbers and currency:

Pluralization, ordinals, and grammar:

Content Beyond Strings

Images and media:

URLs and SEO:

Legal and compliance content:

Translation Workflow

Developer handoff:

  1. Extract strings from code into translation files (JSON, PO, YAML)
  2. Add context comments and screenshot references for ambiguous strings
  3. Freeze source strings before sending to translation to prevent mid-translation churn
  4. Version translation files alongside code releases

Quality assurance:

Continuous localization:

Testing Localized UI

Layout testing:

Functional testing:

Content testing:

Anti-Patterns

Verify Localization Readiness

Before shipping a localized product:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.