flarum/framework · error · RuntimeException
Expected to find " " directory in language pack.
Error message
Expected to find "<path>" directory in language pack.
What it means
Thrown in LanguagePack::registerLocale when an installed language-pack extension does not contain the expected locale directory (extension path + configured path, default /locale). The pack declares a locale code/title in composer.json but ships no directory holding translation files, so no translations can be loaded when LocaleManager is resolved during boot.
Solutions
- Create the missing locale/ directory inside the language pack extension
- Verify the pack's composer.json extra.flarum-locale settings match the directory layout
- Re-download/reinstall the language pack — the installation may be incomplete
- If you are the pack author, ship your translation files under locale/
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at framework/core/src/Extend/LanguagePack.php:71 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of flarum/framework@4b939f6853 (2026-09-15).
Data as JSON: /api/errors/bf8eb143069b6e89.
Report an issue: GitHub.
Appendix: source
Thrown at framework/core/src/Extend/LanguagePack.php:71
);
}
$container->resolving(
LocaleManager::class,
function (LocaleManager $locales, Container $container) use ($extension, $locale, $title) {
$this->registerLocale($container, $locales, $extension, $locale, $title);
}
);
}
private function registerLocale(Container $container, LocaleManager $locales, Extension $extension, string $locale, string $title): void
{
$locales->addLocale($locale, $title);
$directory = $extension->getPath().$this->path;
if (! is_dir($directory)) {
throw new RuntimeException(
'Expected to find "'.$this->path.'" directory in language pack.'
);
}
if (file_exists($file = $directory.'/config.js')) {
$locales->addJsFile($locale, $file);
}
if (file_exists($file = $directory.'/config.css')) {
$locales->addCssFile($locale, $file);
}
foreach (new DirectoryIterator($directory) as $file) {
if ($this->shouldLoad($file, $container)) {
$locales->addTranslations($locale, $file->getPathname());
}
}
}View on GitHub (pinned to 4b939f6853)