daun / statamic-bard-languages
Mark foreign-language words and sections of Statamic content
Package info
github.com/daun/statamic-bard-languages
Language:TypeScript
Type:statamic-addon
pkg:composer/daun/statamic-bard-languages
Requires
- php: ^8.3
- statamic/cms: ^6.8
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.14
- orchestra/testbench: ^10.0 || ^11.0
- phpunit/phpunit: ^12.0 || ^13.0
Suggests
- ext-intl: Derives text direction for any language tag instead of a short built-in list
Provides
None
Conflicts
None
Replaces
None
README
Mark words and sections of Bard content as written in another language.
How it works
Editors pick a language for a phrase or a whole block. The addon adds a lang attribute, plus a dir attribute derived from the language. Screen readers, hyphenation, spell checkers, translation tools, and fonts all use the lang attribute to handle text correctly. Right-to-left passages render correctly in a left-to-right page.
Say <span lang="fr" dir="ltr">bonjour</span> or <span lang="ar" dir="rtl">مرحبا</span>.
Quick start
Install the addon
composer require daun/statamic-bard-languages
Add the button
Add the language button to a Bard field, either in the blueprint editor or in its YAML:
type: bard buttons: - bold - italic - language
Render the content
Nothing to do. Bard outputs the lang and dir attributes like any other markup.
{{ content }}
Documentation
Read the detailed documentation for how selections are marked, language suggestions, restricting languages, and text direction.
