Skip to content

Commit a5eee33

Browse files
committed
Rework loadL10N method.
Changelog excerpt: - Reworked the loadL10N method, how it handles HTTP_ACCEPT_LANGUAGE, improved rule assignment, added some assumptions for supported L10N, and added the ability to defer non-supported L10N to supported L10N where sufficiently similar to be acceptable.
1 parent 1cd69ef commit a5eee33

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,7 @@ __*Why "v3.0.0" instead of "v1.0.0?"*__ Prior to phpMussel v3, the "phpMussel Co
5959
### v3.3.1
6060

6161
[2023.01.14; Maikuolan]: L10N patch and maintenance release.
62+
63+
### v3.4.0
64+
65+
[2023.04.01; Maikuolan]: Reworked the loadL10N method, how it handles HTTP_ACCEPT_LANGUAGE, improved rule assignment, added some assumptions for supported L10N, and added the ability to defer non-supported L10N to supported L10N where sufficiently similar to be acceptable.

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
},
1313
"require": {
1414
"php": ">=7.2.0",
15-
"maikuolan/common": "^2.8",
16-
"phpmussel/core": "^3.3.1",
15+
"phpmussel/core": "^3.4",
1716
"ext-pcre": "*"
1817
},
1918
"autoload": {

src/Web.php

Lines changed: 5 additions & 10 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: Upload handler (last modified: 2022.09.25).
11+
* This file: Upload handler (last modified: 2023.04.01).
1212
*/
1313

1414
namespace phpMussel\Web;
@@ -87,11 +87,11 @@ public function __construct(\phpMussel\Core\Loader &$Loader, \phpMussel\Core\Sca
8787
$this->Uploads = empty($_FILES) ? 0 : count($_FILES);
8888

8989
/** Generate output language information attachment. */
90-
if ($this->Loader->Configuration['core']['lang'] !== $this->Loader->ClientL10NAccepted) {
90+
if ($this->Loader->L10NAccepted !== $this->Loader->ClientL10NAccepted) {
9191
$this->Attache = sprintf(
9292
' lang="%s" dir="%s"',
9393
$this->Loader->ClientL10NAccepted,
94-
$this->Loader->ClientL10N->Data['Text Direction'] ?? 'ltr'
94+
$this->Loader->ClientL10N->Directionality
9595
);
9696
}
9797

@@ -285,11 +285,6 @@ public function scan()
285285
/** Build detections. */
286286
$Detections = implode($this->Loader->L10N->getString('grammar_spacer'), $this->Loader->ScanResultsText);
287287

288-
/** A fix for correctly displaying LTR/RTL text. */
289-
if ($this->Loader->L10N->getString('Text Direction') !== 'rtl') {
290-
$this->Loader->L10N->Data['Text Direction'] = 'ltr';
291-
}
292-
293288
/** Merging parsable variables for the template data. */
294289
$TemplateData = [
295290
'magnification' => $this->Loader->Configuration['web']['magnification'],
@@ -302,8 +297,8 @@ public function scan()
302297
),
303298
'detected' => $Detections,
304299
'favicon' => base64_encode($this->Loader->getFavicon()),
305-
'xmlLang' => $this->Loader->Configuration['core']['lang'],
306-
'Text Direction' => $this->Loader->L10N->Data['Text Direction']
300+
'xmlLang' => $this->Loader->L10NAccepted,
301+
'Text Direction' => $this->Loader->L10N->Directionality
307302
];
308303

309304
/** Pull relevant client-specified L10N data. */

0 commit comments

Comments
 (0)