Search code examples
phplaravellaravel-bladenetlifystatic-site

Date language problem when deploying to Netlify


This is my first time deploying a site in Netlify. I'm using Jigsaw in order to achieve this.

Everything is ok, besides the date language that is exported in production.

When I generate my production site locally it works fine displaying the date in Spanish:

Kenny Horna's blog: Date displaying in Spanish

I'm not uploading the same exact files to netlify but using the netlify.toml to run the same command in order to generate the same files:

# netlify.toml

[build]

command = "npm run production"
publish = "build_production"
environment = { PHP_VERSION = "7.2" }

But in production, the site is displaying the month in English:

Kenny Horna's blog: Date displaying in English

You can check it live here.

Note

To display the date I'm doing this:

@php(setlocale(LC_ALL, 'es_ES'))

<p class="text-gray-700 text-md md:mt-0">
{{ $page->author }}  • {{ strftime("%d de %B, %Y", $page->getDate()->getTimestamp()) }}
</p>

Have you ever experienced something like this?

Thanks in advance for the help.


Update

Modified the netlify.toml to this but still without any luck:

[build]

command = "npm run production"
publish = "build_production"

[context.production.environment]
PHP_VERSION = "7.2"
LC_ALL = "es_ES"

Solution

  • The way that worked (thanks to the link provided by Kalimah Apps) was to change this:

    @php(setlocale(LC_ALL, 'es_ES'))
    

    To this:

    @php(setlocale(LC_ALL, 'es_ES.UTF-8'))
    

    Now is working as it should.