Documentation · Chapter 11

Add Spanish from start to verification.

This workshop adds Spanish, fills missing messages, switches locale, and verifies catalog completeness.

Every lesson starts from the problem, explains the mechanism, then gives a concrete verification.

Create Spanish

Generate es, then keep the same key hierarchy as en and fr. Do not translate keys themselves.

phpaml — zsh
aml i18n:add es
aml i18n:missing es
aml i18n:check
aml i18n:set-default es

Translate and use it

Translate navigation, validation, empty states, and metadata. Test accents, longer labels, and mobile width.

Run the checks

Run check and missing, change the default temporarily, exercise route/cookie/header detection, then restore the intended default.

SUMMARY

What to remember

  • Code stays shared while catalogs carry wording.
  • Keys describe meaning rather than sentences.
  • Locale resolution accepts only supported values.
  • withLocale() isolates each request safely.