filesystem = new Filesystem(); $this->loader = new FileLoader($this->filesystem, $defaultPath ?? ROOT_PATH . 'resources/lang'); // Laravel-style fallback $this->translator = new Translator($this->loader, $defaultLocale); $this->translator->setFallback($fallbackLocale); } public function setLocale(string $locale): void { $this->translator->setLocale($locale); } public function getLocale(): string { return $this->translator->getLocale(); } public function addNamespace(string $namespace, string $path): void { $this->loader->addNamespace($namespace, $path); } public function trans(string $key, array $replace = [], string $locale = null): string { return $this->translator->get($key, $replace, $locale); } public function has(string $key, string $locale = null): bool { return $this->translator->has($key, $locale); } }