From e19e4ebd2490efcc5c5463c1ac11b8a5beca625a Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 11 Jul 2012 10:30:44 -0500 Subject: [PATCH] tweak url for languages. --- laravel/url.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/laravel/url.php b/laravel/url.php index 44b89428..443ddb2a 100644 --- a/laravel/url.php +++ b/laravel/url.php @@ -107,6 +107,14 @@ public static function to($url = '', $https = null) $root = static::base().'/'.Config::get('application.index'); + // If multiple languages are being supported via URIs, we will append current + // language to the URI so all redirects and URLs generated include the + // current language so it is not lost on further requests. + if (count(Config::get('application.languages')) > 0) + { + $root .= '/'.Config::get('application.language'); + } + // Since SSL is not often used while developing the application, we allow the // developer to disable SSL on all framework generated links to make it more // convenient to work with the site while developing locally. @@ -242,6 +250,11 @@ public static function to_asset($url, $https = null) $url = str_replace($index.'/', '', $url); } + if (count(Config::get('application.languages')) > 0) + { + $url = str_replace(Config::get('application.language').'/', '', $url); + } + return $url; }