Absolute paths for theme lang dirs (fixes #1354)

Regression in 4.x i18n rewrite. Can’t test this since ThemeResourceLoader hardcodes constants like THEME_DIR,
so its impossible to mock in different directory structures. Ideally this would use an application object with access
to environment variables, but that’s too much of a refactor to validate this simple fix.
This commit is contained in:
Ingo Schommer 2017-02-17 12:19:52 +13:00
parent 2805a13cc5
commit d2de4b10e1
1 changed files with 3 additions and 3 deletions

View File

@ -91,7 +91,7 @@ class Sources implements Resettable
}
$paths = [];
// Search sorted modules
// Search sorted modules (receives absolute paths)
foreach ($this->getSortedModules() as $module => $path) {
$langPath = "{$path}/lang/";
if (is_dir($langPath)) {
@ -99,14 +99,14 @@ class Sources implements Resettable
}
}
// Search theme dirs
// Search theme dirs (receives relative paths)
$locator = ThemeResourceLoader::instance();
foreach (SSViewer::get_themes() as $theme) {
if ($locator->getSet($theme)) {
continue;
}
$path = $locator->getPath($theme);
$langPath = "{$path}/lang/";
$langPath = BASE_PATH . "/{$path}/lang/";
if (is_dir($langPath)) {
$paths[] = $langPath;
}