Skip to content

Commit dfb0bef

Browse files
committed
URI Locale support
1 parent 6c9f06c commit dfb0bef

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Libraries/Assets.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
***/
2626

2727
use CodeIgniter\Config\BaseConfig;
28+
use CodeIgniter\Config\Config;
2829
use CodeIgniter\Config\Services;
2930
use CodeIgniter\Router\RouteCollectionInterface;
3031
use Tatter\Assets\Exceptions\AssetsException;
@@ -276,7 +277,17 @@ protected function sanitizeRoute()
276277
// Clean up slashes
277278
$this->route = trim($this->route, '/');
278279

280+
// Verify for {locale}
281+
if(Config::get('App')->negotiateLocale) {
282+
$route = explode('/', $this->route);
283+
if(count($route) && $route[0] == Services::request()->getLocale()) {
284+
unset($route[0]);
285+
}
286+
$this->route = implode('/',$route);
287+
}
288+
279289
// If the route is empty then assume the default controller
290+
280291
if (empty($this->route))
281292
{
282293
$this->route = strtolower($this->collection->getDefaultController());

0 commit comments

Comments
 (0)