active() as $module) { $english[] = $module->label(); foreach ($module->permissions() as $permission) { array_push($english, $permission->label, $permission->section); } foreach ($module->navigation() as $item) { $english[] = $item['label']; } foreach ($module->actions() as $action) { $english[] = $action[0]; } array_push($english, ...array_values($module->views())); } $dutch = json_decode(file_get_contents(__DIR__.'/../../resources/lang/nl.json'), true); $missing = collect($english)->unique()->filter(fn (string $text) => $text !== '' && ! array_key_exists($text, $dutch))->values()->all(); expect($missing)->toBe([]); }); it('says the menu and the group form in the language of the app', function () { app()->setLocale('nl'); $registry = app(ModuleRegistry::class); expect(collect($registry->navigation())->pluck('label'))->toContain('Berichten', 'Groepen') ->and(collect($registry->catalogue())->pluck('section'))->toContain('Inhoud van de site'); app()->setLocale('en'); expect(collect($registry->navigation())->pluck('label'))->toContain('Posts'); }); it('lets the site override a text', function () { app()->setLocale('nl'); $folder = sys_get_temp_dir().'/manager-lang-'.uniqid(); mkdir($folder); file_put_contents($folder.'/nl.json', json_encode(['Posts' => 'Nieuws'])); app('translator')->addJsonPath($folder); expect(collect(app(ModuleRegistry::class)->navigation())->pluck('label'))->toContain('Nieuws'); unlink($folder.'/nl.json'); rmdir($folder); });