Skip to content

Commit

Permalink
fix:adjustment regex helpers/current_path_locale
Browse files Browse the repository at this point in the history
Signed-off-by: Crisciany Souza <[email protected]>
  • Loading branch information
Any97Cris committed Oct 9, 2024
1 parent dec92d7 commit cdafb21
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ function current_path_locale($page): string
$path = trim($page->getPath(), '/');

/**
* - [a-z]{2,3} language code
* - [a-z]{2} language code
* - [A-Z]{2} region code
*
* @var string $locale_regex
*/
$locale_regex = '/^(?<locale>(?:[a-z]{2,3}-[A-Z]{2})|(?:[a-z]{2,3}))(?:[^a-zA-Z]|$)/';
$locale_regex = '/^(?<locale>(?:[a-z]{2}-[A-Z]{2})|(?:[a-z]{2}))(?:[^a-zA-Z]|$)/';

preg_match($locale_regex, $path, $matches);

Expand Down

0 comments on commit cdafb21

Please sign in to comment.