mirror of
https://github.com/processwire/processwire.git
synced 2025-08-23 06:44:38 +02:00
Fix issue where wrong directory separator slash could end up in language translation files
This commit is contained in:
@@ -138,11 +138,15 @@ class LanguageTranslator extends Wire {
|
|||||||
foreach($translations as $hash => $translation) {
|
foreach($translations as $hash => $translation) {
|
||||||
if(!strlen($translation['text'])) unset($translations[$hash]);
|
if(!strlen($translation['text'])) unset($translations[$hash]);
|
||||||
}
|
}
|
||||||
|
if(strpos($file, "\\") !== false && strpos($file, "\\" . basename($file))) {
|
||||||
|
// file has MS-DOS style slashes and they are not escapes, convert to unix
|
||||||
|
$file = str_replace("\\", '/', $file);
|
||||||
|
}
|
||||||
return array(
|
return array(
|
||||||
'file' => $file,
|
'file' => $file,
|
||||||
'textdomain' => $textdomain,
|
'textdomain' => $textdomain,
|
||||||
'translations' => $translations
|
'translations' => $translations
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -257,9 +261,13 @@ class LanguageTranslator extends Wire {
|
|||||||
*/
|
*/
|
||||||
protected function textdomainString($textdomain) {
|
protected function textdomainString($textdomain) {
|
||||||
|
|
||||||
if(is_string($textdomain) && (strpos($textdomain, DIRECTORY_SEPARATOR) !== false || strpos($textdomain, '/') !== false)) $textdomain = $this->filenameToTextdomain($textdomain); // @werker #424
|
if(is_string($textdomain) && (strpos($textdomain, DIRECTORY_SEPARATOR) !== false || strpos($textdomain, '/') !== false)) {
|
||||||
else if(is_object($textdomain)) $textdomain = $this->objectToTextdomain($textdomain);
|
$textdomain = $this->filenameToTextdomain($textdomain); // @werker #424
|
||||||
else $textdomain = strtolower($textdomain);
|
} else if(is_object($textdomain)) {
|
||||||
|
$textdomain = $this->objectToTextdomain($textdomain);
|
||||||
|
} else {
|
||||||
|
$textdomain = strtolower($textdomain);
|
||||||
|
}
|
||||||
|
|
||||||
// just in case there is an extension on it, remove it
|
// just in case there is an extension on it, remove it
|
||||||
if(strpos($textdomain, '.')) $textdomain = basename($textdomain, '.json');
|
if(strpos($textdomain, '.')) $textdomain = basename($textdomain, '.json');
|
||||||
|
Reference in New Issue
Block a user