diff --git a/engine/core/class/CodePressCMS.php b/engine/core/class/CodePressCMS.php index 4d0167e..ac3630a 100644 --- a/engine/core/class/CodePressCMS.php +++ b/engine/core/class/CodePressCMS.php @@ -109,6 +109,15 @@ class CodePressCMS { foreach ($items as $item) { if ($item[0] === '.') continue; + // Skip language-specific content that doesn't match current language + if (preg_match('/^(nl|uk)\./', $item)) { + $langPrefix = substr($item, 0, 2); + if (($langPrefix === 'nl' && $this->currentLanguage !== 'nl') || + ($langPrefix === 'uk' && $this->currentLanguage !== 'en')) { + continue; + } + } + $path = $dir . '/' . $item; $relativePath = $prefix ? $prefix . '/' . $item : $item; @@ -510,6 +519,11 @@ class CodePressCMS { * @return string Formatted display name */ private function formatDisplayName($filename) { + // Remove language prefixes (nl. or uk.) from display names + if (preg_match('/^(nl|uk)\.(.+)$/', $filename, $matches)) { + $filename = $matches[2]; + } + // Handle special cases first if (strtolower($filename) === 'phpinfo') { return 'phpinfo'; @@ -627,10 +641,11 @@ class CodePressCMS { */ private function getGuidePage() { $lang = $this->currentLanguage; - $guideFile = __DIR__ . '/../../../guide/' . $lang . '.md'; + $langCode = ($lang === 'en') ? 'uk' : $lang; // Map 'en' to 'uk' for file naming + $guideFile = __DIR__ . '/../../../guide/' . $langCode . '.codepress.md'; if (!file_exists($guideFile)) { - $guideFile = __DIR__ . '/../../../guide/en.md'; // Fallback to English + $guideFile = __DIR__ . '/../../../guide/uk.codepress.md'; // Fallback to English (UK) } $content = file_get_contents($guideFile); diff --git a/guide/nl.md b/guide/nl.codepress.md similarity index 100% rename from guide/nl.md rename to guide/nl.codepress.md diff --git a/guide/en.md b/guide/uk.codepress.md similarity index 100% rename from guide/en.md rename to guide/uk.codepress.md