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

Multi language #3089

Closed
seoeaa opened this issue Apr 28, 2018 · 11 comments
Closed

Multi language #3089

seoeaa opened this issue Apr 28, 2018 · 11 comments
Labels

Comments

@seoeaa
Copy link

seoeaa commented Apr 28, 2018

  • Laravel Version: 5.6.18
  • Voyager Version: 1.1.0
  • PHP Version:7.1
  • Database Driver & Version:5.7

Description:

When I create a page an error occurs
When I create a write out error

Steps To Reproduce:

I tried one language and two languages, the same error

'multilingual' => [
        /*
         * Set whether or not the multilingual is supported by the BREAD input.
         */
        'enabled' => true,
        /*
         * Set whether or not the admin layout default is RTL.
         */
        'rtl' => false,
        /*
         * Select default language
         */
        'default' => 'ru',
        /*
         * Select languages that are supported.
         */
        'locales' => [
            'ru',
           // 'en'
        ],
    ],

ErrorException thrown with message "Undefined index: ru"

Stacktrace:
#57 ErrorException in C:\Server\OSPanel\domains\voyager.dev\vendor\tcg\voyager\src\Traits\Translatable.php:307
#56 Illuminate\Foundation\Bootstrap\HandleExceptions:handleError in C:\Server\OSPanel\domains\voyager.dev\vendor\tcg\voyager\src\Traits\Translatable.php:307
#55 TCG\Voyager\Models\Post:prepareTranslations in C:\Server\OSPanel\domains\voyager.dev\vendor\tcg\voyager\src\Http\Controllers\Controller.php:51
#54 TCG\Voyager\Http\Controllers\Controller:insertUpdateData in C:\Server\OSPanel\domains\voyager.dev\vendor\tcg\voyager\src\Http\Controllers\VoyagerBaseController.php:228
#53 TCG\Voyager\Http\Controllers\VoyagerBaseController:update in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Controller.php:54
#52 call_user_func_array in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Controller.php:54
#51 Illuminate\Routing\Controller:callAction in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php:45
#50 Illuminate\Routing\ControllerDispatcher:dispatch in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Route.php:212
#49 Illuminate\Routing\Route:runController in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Route.php:169
#48 Illuminate\Routing\Route:run in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Router.php:659
#47 Illuminate\Routing\Router:Illuminate\Routing\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:30
#46 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\tcg\voyager\src\Http\Middleware\VoyagerAdminMiddleware.php:27
#45 TCG\Voyager\Http\Middleware\VoyagerAdminMiddleware:handle in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
#44 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#43 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php:41
#42 Illuminate\Routing\Middleware\SubstituteBindings:handle in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
#41 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#40 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken.php:67
#39 Illuminate\Foundation\Http\Middleware\VerifyCsrfToken:handle in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
#38 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#37 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\View\Middleware\ShareErrorsFromSession.php:49
#36 Illuminate\View\Middleware\ShareErrorsFromSession:handle in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
#35 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#34 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php:63
#33 Illuminate\Session\Middleware\StartSession:handle in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
#32 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#31 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse.php:37
#30 Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse:handle in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
#29 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#28 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\EncryptCookies.php:59
#27 Illuminate\Cookie\Middleware\EncryptCookies:handle in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
#26 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#25 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:102
#24 Illuminate\Pipeline\Pipeline:then in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Router.php:661
#23 Illuminate\Routing\Router:runRouteWithinStack in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Router.php:636
#22 Illuminate\Routing\Router:runRoute in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Router.php:602
#21 Illuminate\Routing\Router:dispatchToRoute in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Router.php:591
#20 Illuminate\Routing\Router:dispatch in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php:176
#19 Illuminate\Foundation\Http\Kernel:Illuminate\Foundation\Http\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:30
#18 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\fideloper\proxy\src\TrustProxies.php:57
#17 Fideloper\Proxy\TrustProxies:handle in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
#16 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#15 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php:30
#14 Illuminate\Foundation\Http\Middleware\TransformsRequest:handle in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
#13 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#12 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php:30
#11 Illuminate\Foundation\Http\Middleware\TransformsRequest:handle in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
#10 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#9 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php:27
#8 Illuminate\Foundation\Http\Middleware\ValidatePostSize:handle in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
#7 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#6 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php:46
#5 Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode:handle in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
#4 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#3 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:102
#2 Illuminate\Pipeline\Pipeline:then in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php:151
#1 Illuminate\Foundation\Http\Kernel:sendRequestThroughRouter in C:\Server\OSPanel\domains\voyager.dev\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php:116
#0 Illuminate\Foundation\Http\Kernel:handle in C:\Server\OSPanel\domains\voyager.dev\public\index.php:55

error on line

  // Set the default local value
            $request->merge([$field => $trans[config('voyager.multilingual.default', 'en')]]);
@hungxinh
Copy link

Me too for language => 'vi'

@AlexanderWM
Copy link

@fletch3555 Any more ideas how to fix it? I have the same problem.

@fr8ak2
Copy link

fr8ak2 commented May 30, 2018

I had a quick look on the issue and it's causing by the body field in protected variable in vendor/tcg/voyager/src/Models/Post.php. Need to investigate body field further.

@AlexanderWM
Copy link

@min1mal it seems that bug in multilingual.js by @akazorg

@fr8ak2
Copy link

fr8ak2 commented May 30, 2018

There something strange happening. Because pages are working fine with the same script.

@hungxinh
Copy link

hungxinh commented Jun 1, 2018

Just remove div class="panel-body" in resources/views/posts/edit-add.blade.php:

Change

 @php
   $dataTypeRows = $dataType->{(isset($dataTypeContent->id) ? 'editRows' : 'addRows' )};
   $row = $dataTypeRows->where('field', 'body')->first();
@endphp
<div class="panel-body">
   {!! app('voyager')->formField($row, $dataType, $dataTypeContent) !!}
</div>

To

 @php
   $dataTypeRows = $dataType->{(isset($dataTypeContent->id) ? 'editRows' : 'addRows' )};
   $row = $dataTypeRows->where('field', 'body')->first();
@endphp
{!! app('voyager')->formField($row, $dataType, $dataTypeContent) !!}

@amrittb
Copy link

amrittb commented Feb 23, 2019

Same thing is happening with other BREAD pages too. Any solutions on this yet?

@emptynick
Copy link
Collaborator

Yes, and they are mentioned here and in the referenced issues and PRs.

@amrittb
Copy link

amrittb commented Feb 23, 2019

The PR #3265 fixed only on resources/views/posts/edit-add.blade.php. However, I am getting the error from a BREAD view.

EDIT: Specifically from resources/views/bread/edit-add.blade.php

@emptynick
Copy link
Collaborator

If you have an issue with the current version and searched all issues, please open a new one with all required informations.

@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants