|
@@ -95,18 +95,32 @@ class Translation {
|
|
|
private function loadTranslations() {
|
|
private function loadTranslations() {
|
|
|
$langFile = __DIR__ . '/../languages/' . $this->currentLanguage . '.php';
|
|
$langFile = __DIR__ . '/../languages/' . $this->currentLanguage . '.php';
|
|
|
|
|
|
|
|
|
|
+ error_log("Translation: Loading language file: $langFile");
|
|
|
|
|
+ error_log("Translation: File exists: " . (file_exists($langFile) ? 'YES' : 'NO'));
|
|
|
|
|
+
|
|
|
if (file_exists($langFile)) {
|
|
if (file_exists($langFile)) {
|
|
|
$this->translations = require $langFile;
|
|
$this->translations = require $langFile;
|
|
|
|
|
+ error_log("Translation: Loaded " . count($this->translations) . " translations for {$this->currentLanguage}");
|
|
|
} else {
|
|
} else {
|
|
|
// Fall back to English if current language file doesn't exist
|
|
// Fall back to English if current language file doesn't exist
|
|
|
|
|
+ error_log("Translation: Falling back to English");
|
|
|
$fallbackLangFile = __DIR__ . '/../languages/en.php';
|
|
$fallbackLangFile = __DIR__ . '/../languages/en.php';
|
|
|
if (file_exists($fallbackLangFile)) {
|
|
if (file_exists($fallbackLangFile)) {
|
|
|
$this->translations = require $fallbackLangFile;
|
|
$this->translations = require $fallbackLangFile;
|
|
|
|
|
+ error_log("Translation: Loaded " . count($this->translations) . " fallback translations");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ error_log("Translation: ERROR - English language file not found!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function translate($key, $params = []) {
|
|
public function translate($key, $params = []) {
|
|
|
|
|
+ // Debug: Check if translations are loaded
|
|
|
|
|
+ if (empty($this->translations)) {
|
|
|
|
|
+ error_log("Translation: No translations loaded for language: " . $this->currentLanguage);
|
|
|
|
|
+ error_log("Translation: Available translations: " . print_r($this->translations, true));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (isset($this->translations[$key])) {
|
|
if (isset($this->translations[$key])) {
|
|
|
$translation = $this->translations[$key];
|
|
$translation = $this->translations[$key];
|
|
|
|
|
|
|
@@ -118,6 +132,9 @@ class Translation {
|
|
|
return $translation;
|
|
return $translation;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Debug: Log missing translation
|
|
|
|
|
+ error_log("Translation: Missing key '$key' for language '{$this->currentLanguage}'");
|
|
|
|
|
+
|
|
|
// Return key if translation not found
|
|
// Return key if translation not found
|
|
|
return $key;
|
|
return $key;
|
|
|
}
|
|
}
|