phplaravelfullcalendarfullcalendar-2

Fullcalendar locale in Laravel not working


I used FullCalendar in my Laravel project. I followed a tutorial on YouTube and the https://github.com/maddhatter/laravel-fullcalendar helper. Now I want to add locale settings to my calendar so I can change the language of it. But nothing works. I tried the FullCalendar docs and every solution I could find on the internet, but nothing worked. I hope you can help me.

I tried using the js files in my public folder, and the script from cdnjs.cloudflare but both didn't work.

My view:

@extends('layouts.layout')

<head>
    <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js"></script>

    <script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.2.7/fullcalendar.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.2.7/lang-all.js"></script>

    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.2.7/fullcalendar.min.css"/>
</head>

@section('content')
    </br>
    <div class="control">
    <button onclick="window.location.href = '/calendars/create';">Voeg betaalevenement toe</button>
    </div>
    </br>

    {!! $calendar_details->calendar() !!}
    {!! $calendar_details->script() !!}
@endsection

Solution

  • Eventually, the following code worked for me. I added the '->setOptions(['lang' => 'nl']); in my Controller to my Calendar object.

    $calendar_details = \Calendar::addEvents($event_list)->setOptions(['lang' => 'nl']);
           return view('calendar.index')->with(compact('calendar_details'));
    

    I also added this script to my head:

    <script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.2.7/lang-all.js"></script>