Have the date displayed in french

Hello,

If you go on this crab theme demo page here :
https://themes.gohugo.io//theme/crab/contact/

In the content part, under the title, you can see the date written in English : March 18, 2019

If I would like to use this crab theme, how can you make Hugo write the date in French like :
8 mars 2019

In essence how do you customize the date format to have it writen in my local french language ?

Thanks for th help.

Andrew

It does not work very well.

The best I could get was with those parameters as dateformat

        languageCode = "fr-fr"
        dateFormat = "2 Jan 2006"
        dateFormatFull = "02/01/2006"
        dateFormatTime = "2 Jan 2006 15:04"

I don’t remember exactly the details of my tests but I couldn’t succeed having localized dates in multi-language site (this point is clearly stated in the documentation)

Par exemple ainsi: Dates : only in english? - #41 by emk

Je viens de faire un commit sur un site que je suis en train de développer (ce qui m’a permis de factoriser certaines choses). Voir ici:

https://github.com/nfriedli/minimal-website.ch/blob/master/layouts/partials/date.html

1 Like

Ahhh cool. Insta volé ! Thanks.

1 Like

You could also use a data file, as exemplified in the documentation: Customize Dates.

1 Like

Hello,

Just wanted to say thank you !

With all your replies, I was able to find a solution and display my dates in French.

It’s cool.

1 Like

Hello,

J’aurai besoin encore de précisions de ta part.
Afin d’être optimal, pour ta solution, je dois mettre les deux premières lignes dans le fichier date.html dans layouts/partials.

Puis dans mon modèle, remplacer le code pour la date avec la 3ème ligne ?

C’est comme ceci que tu fais ?

Merci pour tes précisions.

En vacances, je réponds en vitesse en postant ce lien: https://nicolasfriedli.ch/notes/date-francais/

Hello Nicolas,

Ta réponse est parfaite. C’est la pièce du puzzle qui me manquait.
Je vais tester ceci ce soir.
Merci et A+

Andrew