grommasdietz / kirby-locale
Locale utilities for Kirby CMS
Package info
github.com/grommasdietz/kirby-locale
Type:kirby-plugin
pkg:composer/grommasdietz/kirby-locale
Requires
- php: ^8.2
- getkirby/composer-installer: ^1.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.93
- phpunit/phpunit: ^11.5
- vimeo/psalm: ^6.15
README
Locale utilities for Kirby CMS adds a Writer mark and an optional dialog select field so editors can tag language-specific fragments and store per-page title locales.
Requirements
- Kirby 5+
- PHP 8.2+
Installation
composer require grommasdietz/kirby-locale
Tip
If you don’t use Composer, you can download this repository and copy it to site/plugins/kirby-locale.
Quickstart
Writer mark
Enable the locale mark on any Writer field by adding it to the field’s marks list:
fields: text: type: writer marks: - locale
The Writer displays the locale mark in the toolbar and highlights tagged segments. Selections get wrapped in <span lang="…">.
Title locales
Activate the title locale selector via grommasdietz.locale.intendedTemplate in site/config/config.php. For a single template:
return [ 'grommasdietz.locale.intendedTemplate' => 'project', ];
For multiple templates:
return [ 'grommasdietz.locale.intendedTemplate' => [ 'project', 'note', ], ];
After configuration, Kirby's create and rename dialogs show the locale dropdown and save the choice as title_locale. Retrieve it in templates with $page->title_locale().
Options
Configure via site/config/config.php:
return [ // Custom locales 'grommasdietz.locale.locales' => [ ['code' => 'en-GB', 'name' => 'English, United Kingdom'], ['code' => 'en-US', 'name' => 'English, United States'], ], // Optional: disable the ISO fallback catalog // 'grommasdietz.locale.catalog' => false, ];
Documentation
Full reference for usage, contributions and maintenance lives in documentation.
Changelog
See CHANGELOG.md for version history and changes.
Security
See SECURITY.md for security policies and reporting vulnerabilities.
Contributing
See CONTRIBUTING.md for guidance and expectations.
License
MIT © 2025 Grommas Dietz
