Skip to content

Commit 691fc63

Browse files
committed
feat: add intl insights
1 parent 5c1ddbe commit 691fc63

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Tempest\Intl;
4+
5+
use Tempest\Core\Insight;
6+
use Tempest\Core\InsightsProvider;
7+
8+
use function Tempest\Support\arr;
9+
10+
final class IntlInsightsProvider implements InsightsProvider
11+
{
12+
public string $name = 'Locale';
13+
14+
public function __construct(
15+
private readonly IntlConfig $intlConfig,
16+
) {}
17+
18+
public function getInsights(): array
19+
{
20+
return [
21+
'Current locale' => $this->intlConfig->currentLocale->getDisplayLanguage(),
22+
'Fallback locale' => $this->intlConfig->fallbackLocale->getDisplayLanguage(),
23+
'Translation files' => (string) arr($this->intlConfig->translationMessagePaths)->flatten()->count(),
24+
'Intl extension' => extension_loaded('intl') ? new Insight('ENABLED', Insight::SUCCESS) : new Insight('DISABLED', Insight::WARNING),
25+
];
26+
}
27+
}

0 commit comments

Comments
 (0)