From 0957cd680be1612870618e2556d051d012a32c23 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 15 Feb 2023 21:32:44 -0700 Subject: [PATCH] Allow recording of default json group Currently if you use translations like `@lang('Hello World')` or `{{ __('Hello World') }}` the auto-detect when missing functionality doesn't record these. The patch suggested here addresses that so that a _json entry for Hello World is added to the database. --- src/Translator.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Translator.php b/src/Translator.php index 28ed72f6..b0b6cb4f 100644 --- a/src/Translator.php +++ b/src/Translator.php @@ -39,6 +39,12 @@ public function setTranslationManager(Manager $manager) protected function notifyMissingKey($key) { list($namespace, $group, $item) = $this->parseKey($key); + + if($item === null){ + $item = $group; + $group = '_json'; + } + if($this->manager && $namespace === '*' && $group && $item ){ $this->manager->missingKey($namespace, $group, $item); }