Skip to content

Commit 0b42946

Browse files
committed
Bug-fix.
Changelog excerpt: - Explicitly defining the region for the configured L10N where deferment may be available but the region for the corresponding listed configuration choice not included could've caused the L10N loader to simply use fallbacks instead; Fixed.
1 parent 2cd65c6 commit 0b42946

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/Loader.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* License: GNU/GPLv2
99
* @see LICENSE.txt
1010
*
11-
* This file: The loader (last modified: 2023.04.04).
11+
* This file: The loader (last modified: 2023.04.25).
1212
*/
1313

1414
namespace phpMussel\Core;
@@ -93,7 +93,7 @@ class Loader
9393
/**
9494
* @var string phpMussel version number (SemVer).
9595
*/
96-
public $ScriptVersion = '3.3.4';
96+
public $ScriptVersion = '3.4.0';
9797

9898
/**
9999
* @var string phpMussel version identifier (complete notation).
@@ -605,7 +605,15 @@ public function loadL10N(string $Path = ''): void
605605
$Primary = $this->readFile($Path . 'en.yml');
606606
$Fallback = '';
607607
} else {
608-
$Primary = $this->readFile($Path . $this->Configuration['core']['lang'] . '.yml');
608+
if (($Primary = $this->readFile($Path . $this->Configuration['core']['lang'] . '.yml')) === '') {
609+
if (isset($this->ConfigurationDefaults['core']['lang']['defer'][$this->Configuration['core']['lang']])) {
610+
$Primary = $this->readFile($Path . $this->ConfigurationDefaults['core']['lang']['defer'][$this->Configuration['core']['lang']] . '.yml');
611+
}
612+
if ($Primary === '') {
613+
$Try = preg_replace('~-.*$~', '', $this->Configuration['core']['lang']);
614+
$Primary = $this->readFile($Path . $Try . '.yml');
615+
}
616+
}
609617
$Fallback = $this->readFile($Path . 'en.yml');
610618
}
611619
if ($Primary !== '') {

0 commit comments

Comments
 (0)