|
8 | 8 | * License: GNU/GPLv2
|
9 | 9 | * @see LICENSE.txt
|
10 | 10 | *
|
11 |
| - * This file: The loader (last modified: 2024.07.01). |
| 11 | + * This file: The loader (last modified: 2024.07.13). |
12 | 12 | */
|
13 | 13 |
|
14 | 14 | namespace phpMussel\Core;
|
@@ -629,26 +629,28 @@ public function loadL10N(string $Path = ''): void
|
629 | 629 | $Accepted = preg_replace(['~;.*$~', '~[^-A-Za-z]~'], '', $Accepted);
|
630 | 630 | $Primary = '';
|
631 | 631 | $IsSameAs = false;
|
632 |
| - foreach ([$Accepted, strtolower(preg_replace('~-.*$~', '', $Accepted))] as $Accepted) { |
633 |
| - if ($this->L10NAccepted === $Accepted) { |
| 632 | + if ($this->L10NAccepted === $Accepted) { |
| 633 | + $IsSameAs = true; |
| 634 | + break; |
| 635 | + } |
| 636 | + $Main = strpos($Accepted, '-') === false ? '' : strtolower(preg_replace('~-.*$~', '', $Accepted)); |
| 637 | + if (($Primary = $this->readFile($Path . $Accepted . '.yml')) !== '' || ($Primary = $this->readFile($Path . $Main . '.yml')) !== '') { |
| 638 | + break; |
| 639 | + } |
| 640 | + foreach ([$Accepted, $Main] as $Accepted) { |
| 641 | + if ($Accepted === '' || !isset($this->ConfigurationDefaults['core']['lang']['defer'][$Accepted])) { |
| 642 | + break; |
| 643 | + } |
| 644 | + if ($this->L10NAccepted === $this->ConfigurationDefaults['core']['lang']['defer'][$Accepted]) { |
634 | 645 | $IsSameAs = true;
|
635 | 646 | break 2;
|
636 | 647 | }
|
637 |
| - if (($Primary = $this->readFile($Path . $Accepted . '.yml')) !== '') { |
| 648 | + if ( |
| 649 | + ($Primary = $this->readFile($Path . $this->ConfigurationDefaults['core']['lang']['defer'][$Accepted] . '.yml')) !== '' || |
| 650 | + ($Primary = $this->readFile($Path . preg_replace('~-.*$~', '', $this->ConfigurationDefaults['core']['lang']['defer'][$Accepted]) . '.yml')) !== '' |
| 651 | + ) { |
638 | 652 | break 2;
|
639 | 653 | }
|
640 |
| - if (isset($this->ConfigurationDefaults['core']['lang']['defer'][$Accepted])) { |
641 |
| - if ($this->L10NAccepted === $this->ConfigurationDefaults['core']['lang']['defer'][$Accepted]) { |
642 |
| - $IsSameAs = true; |
643 |
| - break 2; |
644 |
| - } |
645 |
| - if ( |
646 |
| - ($Primary = $this->readFile($Path . $this->ConfigurationDefaults['core']['lang']['defer'][$Accepted] . '.yml')) !== '' || |
647 |
| - ($Primary = $this->readFile($Path . preg_replace('~-.*$~', '', $this->ConfigurationDefaults['core']['lang']['defer'][$Accepted]) . '.yml')) !== '' |
648 |
| - ) { |
649 |
| - break 2; |
650 |
| - } |
651 |
| - } |
652 | 654 | }
|
653 | 655 | }
|
654 | 656 | if ($Primary !== '') {
|
@@ -676,7 +678,6 @@ public function loadL10N(string $Path = ''): void
|
676 | 678 | }
|
677 | 679 | } elseif (!($this->ClientL10N instanceof \Maikuolan\Common\L10N)) {
|
678 | 680 | $this->ClientL10N = new \Maikuolan\Common\L10N([], $this->L10N);
|
679 |
| - $this->ClientL10N->autoAssignRules($Accepted); |
680 | 681 | }
|
681 | 682 | }
|
682 | 683 |
|
|
0 commit comments