Skip to content

Commit 79f92e5

Browse files
committed
defer language support in URIs to version 4.
1 parent f5123f9 commit 79f92e5

File tree

3 files changed

+2
-61
lines changed

3 files changed

+2
-61
lines changed

application/config/application.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,6 @@
9494

9595
'language' => 'en',
9696

97-
/*
98-
|--------------------------------------------------------------------------
99-
| Supported Languages
100-
|--------------------------------------------------------------------------
101-
|
102-
| These languages may also be supported by your application. If a request
103-
| enters your application with a URI beginning with one of these values
104-
| the default language will automatically be set to that language.
105-
|
106-
*/
107-
108-
'languages' => array(),
109-
11097
/*
11198
|--------------------------------------------------------------------------
11299
| SSL Link Generation

laravel/laravel.php

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -107,46 +107,6 @@
107107
return Event::first('404');
108108
});
109109

110-
/*
111-
|--------------------------------------------------------------------------
112-
| Gather The URI And Locales
113-
|--------------------------------------------------------------------------
114-
|
115-
| When routing, we'll need to grab the URI and the supported locales for
116-
| the route so we can properly set the language and route the request
117-
| to the proper end-point in the application.
118-
|
119-
*/
120-
121-
$uri = URI::current();
122-
123-
$locales = Config::get('application.languages', array());
124-
125-
$locales[] = Config::get('application.language');
126-
127-
/*
128-
|--------------------------------------------------------------------------
129-
| Set The Locale Based On Route
130-
|--------------------------------------------------------------------------
131-
|
132-
| If the URI starts with one of the supported languages, we will set
133-
| the default language to match that URI segment and shorten the
134-
| URI we'll pass to the router to not include the lang segment.
135-
|
136-
*/
137-
138-
foreach ($locales as $locale)
139-
{
140-
if (starts_with($uri, $locale))
141-
{
142-
Config::set('application.language', $locale);
143-
144-
$uri = trim(substr($uri, strlen($locale)), '/'); break;
145-
}
146-
}
147-
148-
if ($uri === '') $uri = '/';
149-
150110
/*
151111
|--------------------------------------------------------------------------
152112
| Route The Incoming Request
@@ -158,6 +118,8 @@
158118
|
159119
*/
160120

121+
$uri = URI::current();
122+
161123
Request::$route = Routing\Router::route(Request::method(), $uri);
162124

163125
$response = Request::$route->call();

laravel/url.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,6 @@ public static function to($url = '', $https = null)
107107

108108
$root = static::base().'/'.Config::get('application.index');
109109

110-
// If multiple languages are being supported via URIs, we will append current
111-
// language to the URI so all redirects and URLs generated include the
112-
// current language so it is not lost on further requests.
113-
if (count(Config::get('application.languages')) > 0)
114-
{
115-
$root .= '/'.Config::get('application.language');
116-
}
117-
118110
// Since SSL is not often used while developing the application, we allow the
119111
// developer to disable SSL on all framework generated links to make it more
120112
// convenient to work with the site while developing locally.

0 commit comments

Comments
 (0)