Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multilingual urls #98

Closed
wants to merge 4 commits into from
Closed

Multilingual urls #98

wants to merge 4 commits into from

Conversation

arisk
Copy link
Contributor

@arisk arisk commented Jan 19, 2013

Port of Laravel 3 multilingual URLs

@snarexx
Copy link

snarexx commented Jan 19, 2013

Someone has developed a bundle for multilangual urls. http://forums.laravel.io/viewtopic.php?id=2200&p=2
I remember that this bundle took attention of Laravel creators. This can be improved and merged into L4. It would have been great.

@raftalks
Copy link
Contributor

this is great 👍

@prawee
Copy link

prawee commented Jan 22, 2013

+1

1 similar comment
@jaumesala
Copy link

+1

@raftalks
Copy link
Contributor

+1 thanks

@yuters
Copy link
Contributor

yuters commented Jan 22, 2013

+1

@taylorotwell
Copy link
Member

Not exactly how I want to implement, but I do plan to revisit this and integrate it into L4.

@Anahkiasen
Copy link
Contributor

Eager to see this feature back in Laravel 4, it was really useful and nice to work with.

@jaumesala
Copy link

Totally agree, 80% of our clients require multilingual sites and from those, all of them want a good SEO. This feature was really nice, it was one of the reasons that made me decide to move from Codeigniter to Laravel.
Let's pray to our god @taylorotwell ;-)

@rubenlopezgea
Copy link

+1

1 similar comment
@dbpolito
Copy link
Contributor

👍

@asifrust
Copy link

(y)

@snarexx
Copy link

snarexx commented Mar 29, 2013

+1 again

@taylorotwell
Copy link
Member

Integrated this in a more cohesive way. Done. Works basically the same... see locales config in app.

@tlgreg
Copy link

tlgreg commented Apr 5, 2013

See that it has been removed later. What's the current state on this?

@jasonlewis
Copy link
Contributor

@tlgreg It caused more problems then it solved in the long run. Maybe Taylor can provide you with more details. But I don't think it'll be coming back in the near future.

@urbankid
Copy link

urbankid commented Apr 7, 2013

I'm keeping my fingers crossed on this. All my clients require multilingual projects with good SEO as well. Right now it's a nightmare in L4 to achieve this, at least for me.

@barryvdh
Copy link
Contributor

barryvdh commented Apr 7, 2013

I also liked this feature. Made multi-language site much easier. Perhaps it is possible to recreate this functionality as a seperate bundle?

@arisk
Copy link
Contributor Author

arisk commented Apr 8, 2013

You can modify the code from this pull request and include it in your App::before() filter. It should work in the same way.

@barryvdh
Copy link
Contributor

barryvdh commented Apr 8, 2013

I think it can currently also be handled like this:

$languages = array('nl','fr');
$locale = Request::segment(1);
if(in_array($locale, $languages)){
    App::setLocale($locale);
}else{
    $locale = null;
}
Route::group(array('prefix' => $locale), function()
{
    Route::get('/', array('as' => 'home', function(){ //Do something  }));
    Route::get(Lang::get('routes.news'), array('as' => 'news', 'uses' => 'NewsController@showIndex'));
    Route::get('{slug}', 'PageController@showPage');
});

Then you can just use the URL::route() and URL::action() functions, and the locale will be included. The default locale can be left out, but if you want to include it, you can just add it to the language array.
And you can just create a lang/nl/routes.php file to add the translation of the url.

@raftalks
Copy link
Contributor

raftalks commented Apr 9, 2013

@barryvdh thanks, thats exactly what I had in mind too. :)

@frankmichel
Copy link

@barryvdh this is a great solution. would be great if this could be added to the docs somewhere...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.