Files
breadcrumb-the-shire/modules/bookmarks/module.php
fs 1f0b1caf54 feat: module-owned i18n with merge-at-boot translation loading
Each module can now ship its own i18n/ directory with translation files
(default_de.json, default_en.json). At boot time, ModuleI18nLoader
preloads core translations then merges module translations on top via
Reflection into I18n::$strings — the t() helper stays unchanged.

- Add i18nPath property to ModuleManifest
- Add ModuleI18nLoader with Reflection-based preload
- Extract 59 module-exclusive keys from core i18n into module files
  (notifications: 8, bookmarks: 41, addressbook: 10)
- Expand TranslationKeysTest to scan modules/ and validate against
  merged core + module translations
- Add ModuleI18nContractTest for per-module de/en parity and completeness

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 22:08:34 +01:00

135 lines
4.6 KiB
PHP

<?php
/**
* Bookmarks module manifest.
*
* Owns bookmark routes, topbar/aside/dialog UI, runtime components,
* and bookmark session/layout providers.
*/
return [
'id' => 'bookmarks',
'version' => '1.0.0',
'enabled_by_default' => true,
'load_order' => 20,
'requires' => [],
'routes' => [
['path' => 'bookmarks/save-data', 'target' => 'bookmarks/save-data'],
['path' => 'bookmarks/update-data', 'target' => 'bookmarks/update-data'],
['path' => 'bookmarks/delete-data', 'target' => 'bookmarks/delete-data'],
['path' => 'bookmarks/group-save-data', 'target' => 'bookmarks/group-save-data'],
['path' => 'bookmarks/group-delete-data', 'target' => 'bookmarks/group-delete-data'],
['path' => 'bookmarks/reorder-data', 'target' => 'bookmarks/reorder-data'],
],
'public_paths' => [],
'container_registrars' => [
\MintyPHP\Module\Bookmarks\BookmarksContainerRegistrar::class,
],
'ui_slots' => [
'aside.tab_panel' => [
[
'key' => 'bookmarks',
'label' => 'Bookmarks',
'icon' => 'bi-bookmark-star',
'href' => '',
'permission' => 'bookmarks.use',
'panel_template' => 'templates/aside-bookmarks-panel.phtml',
'details_storage' => 'aside-bookmarks-groups-v1',
'order' => 120,
],
],
'topbar.right_item' => [
[
'key' => 'bookmarks-toggle',
'template' => 'templates/topbar-bookmark-button.phtml',
'permission' => 'bookmarks.use',
'order' => 120,
],
],
'layout.body_end_template' => [
[
'key' => 'bookmarks-dialogs',
'template' => 'templates/bookmark-dialogs.phtml',
'permission' => 'bookmarks.use',
'order' => 120,
],
],
'layout.head_style' => [
[
'key' => 'bookmarks-form-style',
'path' => 'modules/bookmarks/css/components/app-bookmark-form.css',
'permission' => 'bookmarks.use',
'order' => 120,
],
[
'key' => 'bookmarks-aside-style',
'path' => 'modules/bookmarks/css/layout/app-sidebar-bookmarks.css',
'permission' => 'bookmarks.use',
'order' => 121,
],
],
'search.resource_item' => [
[
'key' => 'bookmarks',
'label' => 'Bookmarks',
'base_url' => '#',
'permission' => 'bookmarks.use',
'order' => 130,
],
],
'runtime.component' => [
[
'key' => 'bookmark-save',
'script' => 'modules/bookmarks/js/components/app-bookmark-save.js',
'export' => 'initBookmarkSave',
'scope' => 'global',
'config_path' => 'components.bookmarkSave',
'default_config' => [
'openButtonSelector' => '[data-bookmark-open-dialog]',
'dialogSelector' => '[data-app-bookmark-dialog]',
'groupDialogSelector' => '[data-app-bookmark-group-dialog]',
],
'phase' => 'late',
'permission' => 'bookmarks.use',
'order' => 120,
],
[
'key' => 'bookmark-panel',
'script' => 'modules/bookmarks/js/components/app-bookmark-panel.js',
'export' => 'initBookmarkPanel',
'selector' => '[data-app-bookmark-panel]',
'config_path' => 'components.bookmarkPanel',
'default_config' => [
'selector' => '[data-app-bookmark-panel]',
],
'phase' => 'late',
'permission' => 'bookmarks.use',
'order' => 121,
],
],
],
'authorization_policies' => [
\MintyPHP\Module\Bookmarks\BookmarksAuthorizationPolicy::class,
],
'search_resources' => [
\MintyPHP\Module\Bookmarks\Providers\BookmarksSearchProvider::class,
],
'asset_groups' => [],
'scheduler_jobs' => [],
'layout_context_providers' => [
\MintyPHP\Module\Bookmarks\Providers\BookmarksLayoutProvider::class,
],
'session_providers' => [
\MintyPHP\Module\Bookmarks\Providers\BookmarksSessionProvider::class,
],
'permissions' => [],
'migrations_path' => null,
'i18n_path' => 'i18n',
];