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

Working with Laravel Nova #617

Open
covaberjon opened this issue Jan 23, 2019 · 7 comments
Open

Working with Laravel Nova #617

covaberjon opened this issue Jan 23, 2019 · 7 comments

Comments

@covaberjon
Copy link

covaberjon commented Jan 23, 2019

First of all, thank you for the package.

I have a problem using your package with Laravel Nova. I am only using your package with my frontend routes. However, my laravel nova backend is being affected.

Instead of showing my ES translations, is showing EN translations.

I tried adding:

'urlsIgnored' => ['/nova/*']

But it didn't work.

The only thing that actually worked was setting useAcceptLanguageHeader to false.

@YannikFirre
Copy link

Same problem caused by "LaravelLocalization::setLocale()" in ->prefix(LaravelLocalization::setLocale())

@maherelgamil
Copy link

Any updates here ?

@marijoo
Copy link

marijoo commented Nov 19, 2019

Any updates?

@iwasherefirst2
Copy link
Collaborator

Sorry but Laravel Nova is not open source, so I can't look into it to help you. You may need to fix it by yourself and send a PR. Or switch to an open source admin panel: https://voyager.devdojo.com/

@gavinhewitt
Copy link

Maybe I don't understand but can't you just create a 'frontend' middlewaregroup and reference that wherever you need route localization? That's what I do. Using a seperate group for frontend does not affect any Nova routes.

@ysfkaya
Copy link

ysfkaya commented Jun 20, 2020

I have solved this issue for me. I have created a helper function for routing with using LaravelLocalization class. Try this in web.php instead of transRoute method. Add the nova paths in config file btw.

function __route($name)
{
    $shouldIgnore = function ($request) {
        $excepts = config('laravellocalization.urlsIgnored', []);

        foreach ($excepts as $except) {
            if ($except !== '/') {
                $except = trim($except, '/');
            }

            if ($request->is($except)) {
                return true;
            }
        }

        return false;
    };


    if ($shouldIgnore(request())) {
        return;
    }

    return LaravelLocalization::transRoute('routes.' . $name);
}

@namnh06
Copy link

namnh06 commented Oct 11, 2020

@ysfkaya no luck man :(.

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

8 participants