From 51104a1d559d07fa281dc67bbe7e9b39e926a8a2 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 1 Feb 2016 22:53:13 -0700 Subject: [PATCH] Added language support to the initializeFromUrl() method --- system/src/Grav/Common/Uri.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index 7711522be..75374b1a1 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -197,6 +197,10 @@ class Uri $this->root = []; $this->url = []; + $grav = Grav::instance(); + + $language = $grav['language']; + $params = Uri::parseUrl($url); $this->name = $params['host']; @@ -204,6 +208,9 @@ class Uri $this->uri = $params['path']; + // set active language + $uri = $language->setActiveFromUri($this->uri); + if (isset($params['params'])) { $this->params($params['params']); } @@ -218,7 +225,8 @@ class Uri $this->env = $this->buildEnvironment(); $this->root_path = $this->buildRootPath(); $this->root = $this->base . $this->root_path; - $this->url = $this->base . $this->uri; + $this->url = $this->root . $uri; + $this->path = $uri; return $this; }