Browse Source

tweak url for languages.

Taylor Otwell 12 years ago
parent
commit
e19e4ebd24
1 changed files with 13 additions and 0 deletions
  1. 13 0
      laravel/url.php

+ 13 - 0
laravel/url.php

@@ -107,6 +107,14 @@ class URL {
 
 		$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 @@ class URL {
 			$url = str_replace($index.'/', '', $url);
 		}
 
+		if (count(Config::get('application.languages')) > 0)
+		{
+			$url = str_replace(Config::get('application.language').'/', '', $url);
+		}
+
 		return $url;
 	}