feat: AfterInstall creates custom i18n directories for all locales

Ensures custom/Espo/Custom/Resources/i18n/{locale}/ exists for
en_US, fa_IR, he_IL, and the system language. Without this, Label
Manager fails with 500 on fresh installs using fa_IR (Hebrew RTL
wrapper) because the directory doesn't exist and EspoCRM doesn't
create it automatically.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-06 14:27:44 +00:00
parent ee55f1ecef
commit 19db7c1093
3 changed files with 26 additions and 1 deletions
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "LegalAssistance",
"version": "1.2.3",
"version": "1.3.0",
"acceptableVersions": [">=8.0.0"],
"php": [">=8.1"],
"releaseDate": "2026-04-06",
+25
View File
@@ -24,6 +24,10 @@ class AfterInstall
$log->info('LegalAssistance: Running AfterInstall...');
// 0. Ensure custom i18n directories exist for all supported locales
$config = $container->getByClass(Config::class);
$this->ensureI18nDirectories($config, $log);
// 1. Deploy ai-gateway plugin files
$this->deployPluginFiles($log);
@@ -42,6 +46,27 @@ class AfterInstall
$log->info('LegalAssistance: AfterInstall completed.');
}
private function ensureI18nDirectories(Config $config, Log $log): void
{
$basePath = 'custom/Espo/Custom/Resources/i18n';
$language = $config->get('language', 'en_US');
$locales = array_unique(['en_US', 'fa_IR', 'he_IL', $language]);
foreach ($locales as $locale) {
$dir = $basePath . '/' . $locale;
if (!is_dir($dir)) {
if (mkdir($dir, 0775, true)) {
$log->info("LegalAssistance: Created i18n directory: {$dir}");
} else {
$log->warning("LegalAssistance: Failed to create i18n directory: {$dir}");
}
}
}
}
private function deployPluginFiles(Log $log): void
{
// Source: extension's plugins/ directory (relative to EspoCRM root after install)