Extract shared LanguageSwitcher and MultilangForm components - #435
Merged
Conversation
Add two shared components to replace duplicated language switching UI across entities and publishing modules: - LanguageSwitcher: configurable language selector with inline, tabs, and pills variants. Supports status dots, primary indicators, display modes, prefix URLs, accessibility attrs, safe coercion, and dev-time validation for conflicting attrs. - MultilangForm: form helpers for multilang translation workflows. Provides mount_multilang, handle_switch_language, translatable_field with error display, skeleton wrapper, and inject_db_field_into_data. Supports both JSONB data and settings translations models via secondary_name/lang_data_key overrides. Swap all entity forms (data_form, entity_form, data_view) and all publishing templates to use the shared components. Remove the old publishing-specific language_switcher.ex. Add crash-proof rescue blocks to entity data form validate/save handlers. Includes 86 new component tests covering rendering, display modes, filtering, status dots, interaction modes, coercion, accessibility, error display, and field attribute forwarding. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ddon
added a commit
that referenced
this pull request
Mar 19, 2026
- Precompute show_multilang_tabs assign in mount_multilang/refresh_multilang to avoid O(n) length/1 calls on every render - Replace O(n²) Enum.at/2 lookup in language_switcher loop with precomputed MapSet of divider indices - Consolidate preserve_primary_fields into shared MultilangForm helper, removing duplicate from data_form.ex - Add PR #435 review Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ddon
added a commit
that referenced
this pull request
Mar 19, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add two shared components to replace duplicated language switching UI across entities and publishing modules:
LanguageSwitcher: configurable language selector with inline, tabs, and pills variants. Supports status dots, primary indicators, display modes, prefix URLs, accessibility attrs, safe coercion, and dev-time validation for conflicting attrs.
MultilangForm: form helpers for multilang translation workflows. Provides mount_multilang, handle_switch_language, translatable_field with error display, skeleton wrapper, and inject_db_field_into_data. Supports both JSONB data and settings translations models via secondary_name/lang_data_key overrides.
Swap all entity forms (data_form, entity_form, data_view) and all publishing templates to use the shared components. Remove the old publishing-specific language_switcher.ex. Add crash-proof rescue blocks to entity data form validate/save handlers.
Includes 86 new component tests covering rendering, display modes, filtering, status dots, interaction modes, coercion, accessibility, error display, and field attribute forwarding.