From d2de4b10e11633ce9fe16e781eb65da7dc0b184f Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 17 Feb 2017 12:19:52 +1300 Subject: [PATCH] Absolute paths for theme lang dirs (fixes #1354) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/i18n/Data/Sources.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/i18n/Data/Sources.php b/src/i18n/Data/Sources.php index 69b47fc5b..eb45d17ac 100644 --- a/src/i18n/Data/Sources.php +++ b/src/i18n/Data/Sources.php @@ -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; }