Skip to content

Commit f374b57

Browse files
committed
L10N bug-fix.
1 parent e6a5e4d commit f374b57

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

l10n/ta.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# License: GNU/GPLv2
88
# @see LICENSE.txt
99
#
10-
# This file: Tamil language data (last modified: 2020.07.14).
10+
# This file: Tamil language data (last modified: 2020.07.15).
1111
##/
1212

1313
# Language settings.
@@ -55,7 +55,7 @@ scan_chameleon: "%s பச்சோந்தி தாக்குதல் க
5555
scan_checking: ""%s" ஐ சரிபார்க்கிறது."
5656
scan_command_injection: "கட்டளை ஊசி முயற்சி கண்டறியப்பட்டது"
5757
scan_complete: "முடிந்தது"
58-
scan_extensions_missing: "தோல்வி (தேவையான நீட்டிப்புகளைக் காணவில்லை)!"
58+
scan_extensions_missing: "தோல்வி (தேவையான நீட்டிப்புகளைக் காணவில்லை)!"
5959
scan_filename_manipulation_detected: "கோப்பு பெயர் கையாளுதல் கண்டறியப்பட்டது"
6060
scan_missing_filename: "கோப்பு பெயர் இல்லை"
6161
scan_no_problems_found: "எந்த சிக்கலும் காணப்படவில்லை."

src/Loader.php

Lines changed: 15 additions & 14 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: 2020.07.13).
11+
* This file: The loader (last modified: 2020.07.16).
1212
*/
1313

1414
namespace phpMussel\Core;
@@ -567,29 +567,31 @@ public function loadL10N(string $Path = '')
567567
/** Load client-specified L10N data if possible. */
568568
if (!$this->Configuration['core']['lang_override'] || empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
569569
if (!($this->ClientL10N instanceof \Maikuolan\Common\L10N)) {
570-
$this->ClientL10N = &$L10N;
570+
$this->ClientL10N = &$this->L10N;
571571
}
572572
} else {
573573
$Accepted = preg_replace(['~^([^,]*).*$~', '~[^-A-Za-z]~'], ['\1', ''], $_SERVER['HTTP_ACCEPT_LANGUAGE']);
574574
$Primary = '';
575-
if (
576-
$this->Configuration['core']['lang'] !== $Accepted &&
577-
is_readable($Path . $Accepted . '.yml')
578-
) {
575+
$IsSameAs = false;
576+
if ($this->Configuration['core']['lang'] === $Accepted) {
577+
$IsSameAs = true;
578+
} elseif (is_readable($Path . $Accepted . '.yml')) {
579579
$Primary = $this->readFile($Path . $Accepted . '.yml');
580-
}
581-
if (!$Primary) {
580+
} else {
582581
$Accepted = strtolower(preg_replace('~^([^-]*).*$~', '\1', $Accepted));
583-
if (
584-
$this->Configuration['core']['lang'] !== $Accepted &&
585-
is_readable($Path . $Accepted . '.yml')
586-
) {
582+
if ($this->Configuration['core']['lang'] === $Accepted) {
583+
$IsSameAs = true;
584+
} elseif (is_readable($Path . $Accepted . '.yml')) {
587585
$Primary = $this->readFile($Path . $Accepted . '.yml');
588586
}
589587
}
590588

591589
/** Process client-specified L10N data. */
592-
if ($Primary) {
590+
if ($IsSameAs) {
591+
if (!($this->ClientL10N instanceof \Maikuolan\Common\L10N)) {
592+
$this->ClientL10N = &$this->L10N;
593+
}
594+
} elseif ($Primary) {
593595
$Arr = [];
594596
if (!$this->ClientL10NAccepted) {
595597
$this->ClientL10NAccepted = $Accepted;
@@ -603,7 +605,6 @@ public function loadL10N(string $Path = '')
603605
$this->ClientL10N = new \Maikuolan\Common\L10N($Arr, $this->L10N);
604606
}
605607
} elseif (!($this->ClientL10N instanceof \Maikuolan\Common\L10N)) {
606-
$this->ClientL10NAccepted = $Accepted;
607608
$this->ClientL10N = new \Maikuolan\Common\L10N([], $this->L10N);
608609
}
609610
}

0 commit comments

Comments
 (0)