ComponentMessages
Resolves a component's declared words for one locale. English is the default AND the fallback, per key rather than per catalogue: a locale that translates half of one renders the other half in English instead of rendering a key name at somebody. That is the difference between a translation being incomplete and a page being broken. A component that declares no catalogue resolves to nothing, and asking for one of its keys returns the key. That is deliberate and it is visible: a key on screen is a bug report anybody can file, where an empty string is a layout that silently lost a word. Catalogues are read once per path per process. They are PHP files returning `['en' => [...], 'es' => [...]]` — the shape the rest of this house already uses for config, which costs no parser and lets a translator read the file without learning a format.
ComponentMessages::for()
public function for(Milpa\Live\ValueObjects\ComponentContract $contract, string $locale = self::DEFAULT_LOCALE): arrayEvery word this component has, in the best language it has them.
Parameters
| Name | Type | Description |
|---|---|---|
| $contract | Milpa\Live\ValueObjects\ComponentContract | |
| $locale | string |