Skip to content

Commit cbc5b2f

Browse files
committed
fix(intl): allow translator without event bus
1 parent fd2a739 commit cbc5b2f

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

packages/intl/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
},
1515
"suggest": {
1616
"tempest/datetime": "In order to use the `datetime` function",
17-
"tempest/icon": "In order to use the `icon` function"
17+
"tempest/icon": "In order to use the `icon` function",
18+
"tempest/event-bus": "Enables dispatching translation miss and translation failure events."
1819
},
1920
"autoload": {
2021
"files": [

packages/intl/src/TranslatorInitializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function initialize(Container $container): Translator
1818
config: $container->get(IntlConfig::class),
1919
catalog: $container->get(Catalog::class),
2020
formatter: $container->get(MessageFormatter::class),
21-
eventBus: $container->get(EventBus::class),
21+
eventBus: interface_exists(EventBus::class) ? $container->get(EventBus::class) : null,
2222
);
2323
}
2424
}

0 commit comments

Comments
 (0)