Skip to content

Commit

Permalink
Bug-fix.
Browse files Browse the repository at this point in the history
Changelog excerpt:
- 3-digit and script-based codes not recognised by arrayFromL10nToArray;
  Fixed.
  • Loading branch information
Maikuolan committed Jul 2, 2024
1 parent f7bf7ee commit c444f25
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ found at:

=== Changes made since last versioned release ===

(none)
- [2024.07.02; Bug-fix; Maikuolan]: 3-digit and script-based codes not
recognised by arrayFromL10nToArray; Fixed.

=== Version/Release 2.12.1 ===
PATCH RELEASE.
Expand Down
4 changes: 2 additions & 2 deletions src/L10N.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* L10N handler (last modified: 2024.06.22).
* L10N handler (last modified: 2024.07.02).
*
* This file is a part of the "common classes package", utilised by a number of
* packages and projects, including CIDRAM and phpMussel.
Expand Down Expand Up @@ -225,7 +225,7 @@ public function arrayFromL10nToArray($References): array
$Try = $Reference;
}
}
$Reference = (!is_array($Try) || preg_match('~^[a-z]{2}(?:-[A-Z]{2})?$~', key($Try))) ? [$Try] : $Try;
$Reference = (!is_array($Try) || preg_match('~^[a-z]{2,3}(?:-[A-Z][A-Za-z]{1,3})?$~', key($Try))) ? [$Try] : $Try;
foreach ($Reference as $Key => $Value) {
if (is_array($Value)) {
$Value = $this->PreferredVariant !== '' && isset($Value[$this->PreferredVariant]) ? $Value[$this->PreferredVariant] : array_shift($Value);
Expand Down

0 comments on commit c444f25

Please sign in to comment.