The title, alt text and description of a media file, in every language of the site at once: a tab per language, one form, one Save.
Each language is a panel with its own three inputs, named
details[<language>][title] (and alt, description), so a form posts a
block per language and PhoenixKit.Modules.Storage.FileDetails.by_language/3
reads it back. The tabs only show and hide panels, in the browser
(Phoenix.LiveView.JS): nothing is sent to the server when you switch, so
what you have typed in another language is still there, and the page's own
language is not touched. LiveView keeps a tab's state across the form's
re-renders.
A site with one language has no tabs: its one panel is shown as it is. The inputs show the language's own text; the primary language's text is only a placeholder, so an untouched language is not saved as a copy of it. A tab whose language has no text yet carries a dot.
Used by the viewer's sidebar, the one place a file's text is edited.
Summary
Functions
Attributes
id(:string) (required) - DOM id prefix; unique on the page.languages(:list) - tabs fromMultilang.build_language_tabs/0;[]on a single-language site. Defaults to[].lang(:string) (required) - the language shown first (the only one without tabs).values(:map) (required) -%{language => %{title:, alt:, description:}}: each language's own text.placeholders(:map) - the primary language's text, as placeholders. Defaults to%{description: "", title: "", alt: ""}.show_alt(:boolean) - alt text is for images. Defaults totrue.labels(:boolean) - a label above each input. Defaults totrue.name(:string) - the form field prefix. Defaults to"details".