Language settings in production

This is my first time deploying a site in Netlify. I’ve used Tighten’s Jigsaw to create my static site.

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

When I build my production site locally, it works fine displaying the date in Spanish (as it should be).

I’m not uploading the build_production directory directly to netlify but using the netlify.toml to run the same command whenever I push changes to my repo. It should 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

It should display “23 de octubre, 2019” instead.

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.

Hi Kenny!

You’re one of the very few people using PHP on our platform, so we haven’t really seen anything like that before (or at least, none of our customers have brought it up).

Our debug advice would be to try running locally (cf https://github.com/netlify/build-image#running-locally) and seeing if you can understand what is missing (maybe a php locale package? Maybe a system locale package, but I think we have most or all of the es* ones…

Anyway once you get it narrowed down to what config or package(s) are missing, we’ll be in a better place to understand how soon we can try to get it fixed (spoiler: not very soon, changing the build image is a very time consuming process and may not happen for weeks or a month)

Yeah, I changed this:

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

To this:

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

And now it’s working.

1 Like

So great to hear you found a solution you can apply already! And very many thanks for following up to share with the rest of the community :slight_smile:
Have a great Sunday!

2 Likes