Skip to content

Commit 70e2df1

Browse files
authored
perf(intl): lazy load catalog fallback (#2162)
1 parent 48b7813 commit 70e2df1

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

packages/intl/src/Catalog/GenericCatalog.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,7 @@ public function has(Locale $locale, string $key): bool
2121

2222
public function get(Locale $locale, string $key): ?string
2323
{
24-
return Arr\get_by_key(
25-
array: $this->catalog,
26-
key: "{$locale->value}.{$key}",
27-
default: Arr\get_by_key(
28-
array: $this->catalog,
29-
key: "{$locale->getLanguage()}.{$key}",
30-
),
31-
);
24+
return Arr\get_by_key($this->catalog, "{$locale->value}.{$key}") ?? Arr\get_by_key($this->catalog, "{$locale->getLanguage()}.{$key}");
3225
}
3326

3427
public function add(Locale $locale, string $key, string $message): self

0 commit comments

Comments
 (0)