Why date is not translated in online version?

Hi,

I made a blog with Hugo https://www.davidecalabria.com translated in italian. Even Date and Time of Reading is translated in the locahost version, and I updated the repository in github many times, but in the online version on Netlify I still get them in english.

Can someone help me, please?

Hi @DavideCalabria

Are you able to share the git repository you deploy from? Might help in tracking down the root of the problem you are facing.

Based on this:

and this:

What you’re seeing is expected.

Not sure if Hugo was updated to support such a thing after these posts, but I don’t see anything about it.

@coelmay
Give thanks,
The git repository is:
https://github.com/DavideCalabria/myblog

@hrishikesh
I managed it as follow:
In the file it.toml (folder i18n) I added:

[Month]
[January]
other = “Gennaio”
[February]
other = “Febbraio”
[March]
other = “Marzo”
…

And in the theme’s directory > Layout > _default > single.html I deleted:

{{- .Date.Format (default “January 2, 2006” .Site.Params.date_format) -}}

and put :

{{i18n "created_on’}} {{.Date.Day}} {{i18n .Date.Month}} {{.Date.Year}}

In this way I see date in italian, but just in localhost at the moment, not online.

Hi ran your code locally, but i’m seeing dates in English:

Are you sure it works locally? Do we need any extra steps?

I simply ran hugo server.

In my localhost it is all translated , but
may be it’s not online because the theme directory is not updating in git when I push, I saw it later, sorry. Today I read something about to add submodule for the theme in order to see chances online.May be, is this the solution? Is there a tutorial to do it, just in case?

You’re using a submodule for theme, if you feel it’s not updating, you could try to add the theme’s files in your repo instead of using it as a submodule to see if it changes anything.

@hrishikesh

You’re using a submodule for theme, if you feel it’s not updating, you could try to add the theme’s files in your repo instead of using it as a submodule to see if it changes anything.

And it worked, many thanks! Now the website is all translated.

1 Like