This Pull Request introduces a method to automatically register language files for modules. By default, this option is enabled, but it can be managed by the client based on their needs from config.
When automatic registration of translations is enabled, the following section can be removed from all modules: 🚀
public function registerTranslations(): void
{
$langPath = resource_path('lang/modules/'.$this->moduleNameLower);
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
$this->loadJsonTranslationsFrom($langPath);
} else {
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
}
}
After this pull request is merged, I will create another pull request to update the stubs for service providers and perform some cleanup to prevent the registration of duplicate processes.
Please note that this update does not support language files located at resource_path('lang/modules/'.$this->moduleNameLower). Clients will need to register this path manually if needed.
Hi,
This Pull Request introduces a method to automatically register language files for modules. By default, this option is enabled, but it can be managed by the client based on their needs from config.
When automatic registration of translations is enabled, the following section can be removed from all modules: 🚀
After this pull request is merged, I will create another pull request to update the stubs for service providers and perform some cleanup to prevent the registration of duplicate processes.
Please note that this update does not support language files located at
resource_path('lang/modules/'.$this->moduleNameLower)
. Clients will need to register this path manually if needed.Please review and provide your feedback.