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

Add multi-language support to the admin (Ability to add languages to admin) #10

Open
chadanuk opened this issue Oct 24, 2016 · 5 comments

Comments

@chadanuk
Copy link
Contributor

No description provided.

@chadanuk chadanuk changed the title Add multi-language support to the admin Add multi-language support to the admin (Ability to add languages to admin) Jun 5, 2017
@jva91
Copy link

jva91 commented Jul 4, 2017

It would be nice if you can manage different languages in the backend.

@SarajevoNo1
Copy link

With Neils help we are at the finish line of the lang switcher implementing, and Please Neil do not forgot to update the script with new version here and in the demo version on your site !! :))

Danke :)

@jayhaluska
Copy link

jayhaluska commented Mar 6, 2019

I know this issue is quite old, but are there any plans on multi-language support for the backend or is this abandoned?

Seems like someone made some progress in this regard but didn't finish it. If I get some support, I would implement the feature

Coaster fits all my needs for a Laravel CMS except multi-language support.

EDIT: Now I'm confused: is this issue about having different languages in the admin backend or creating multilingual pages?

@chadanuk
Copy link
Contributor Author

chadanuk commented Mar 6, 2019

@Paluschki It isn't too tricky actually, (it's not built in out of the box yet). See #25

The key is to add a new language in the database table languages.

The admin will then display a language switcher (https://github.com/Web-Feet/coasterframework/blob/f4ad185076d996cc80de928f2442368bffb34f37/src/Helpers/Admin/View/AdminMenu.php#L33)

On the front end then you'll need to add a form that submits a way to set the language..

$languageId = Request::input('lang');
\CoasterCms\Models\Language::set($languageId);

OR you may want to override the Coaster routes in routes/web.php if you want domain/lang/route type routes to be somthing like...

// catch all (rest must be cms pages)
Route::any('{lang}/{other}', ['uses' => 'CmsController@generatePage'])->middleware('language.change')->where('other', '.*');

The language.change middleware would have the logic to change the language, something like:

$languages = ['en-gb' => 'English', 'fr-fr' => 'French'];

$language = Language::where('language', array_search($request->route->parameter('lang')->first(), $languages));
\CoasterCms\Models\Language::set($language->id);

@neil-jennings
Copy link
Contributor

Also little bit more info here on building a form for a frontend switcher, and also url changing:
https://github.com/Web-Feet/coasterdocs/blob/master/languages.md

And if you want to use the default language as a fallback for content you can set
frontend.language_fallback to 1 in the settings table (maybe need to add new row)

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

No branches or pull requests

5 participants