Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

Grave updated issue: MONTHS_OF_THE_YEAR[7] 15, 2018

Solved by Nico Petri View solution

Started by carlos 7 years ago · 6 replies · 872 views
7 years ago

good afternoon all,
I just upgrade grav to v1.6.3 - Admin v1.9.0 and the dates in the webpage look like this: MONTHS_OF_THE_YEAR[7] 15, 2018
I also update the plugins.

What should I change to fix this issue? Im using custom template from gateway.

thanks in advance
Carlos.

👍 1
7 years ago

Hi there,

try to setup a languages file in /user/languages/en.yaml with:

TXT
MONTHS_OF_THE_YEAR: [January, ... ]
last edited 05/11/20 by pamtbaau
7 years ago

thanks a lot npetri, I dont have that folder...
neverheless I found this in ...\user\themes\gateway\templates\partials:

TWIG
{% if truncate %}
<div class="entry-date">
  {{ 'MONTHS_OF_THE_YEAR'|ta(page.date|date('n') - 1) }} {{ page.date|date('d, Y') }}
</div>
{% endif %}

{% if not truncate %}
<div class="entry-meta">
  <span class="posted-on">Posted on
    <a href="{{ page.url }}" rel="bookmark">
      <time class="entry-date published" datetime="{{ 'MONTHS_OF_THE_YEAR'|ta(page.date|date('n') - 1) }} {{ page.date|date('d, Y') }}">
        {{ 'MONTHS_OF_THE_YEAR'|ta(page.date|date('n') - 1) }} {{ page.date|date('d, Y') }}
      </time>

its here?
best
Carlos

7 years ago Solution

MONTHS_OF_THE_YEAR is used within this template to translate the date to different languages. Grav looks in different files for a translation. As is said, create a file named en.yaml (for english, de for german etc) in /user/languages with the following content:

TXT
MONTHS_OF_THE_YEAR: [January, February, March, April, May, June, July, August, September, October, November, December]

Another way is to create a languages.yaml file in the theme folder directly. But the syntax is as follows:

YAML
en:
  MONTHS_OF_THE_YEAR: [January, February, March, April, May, June, July, August, September, October, November, December]

I hope it works. 🤞

👍 1
last edited 05/11/20 by pamtbaau
7 years ago

With theme folder i meant /user/themes/gateway

👍 1
last edited 05/11/20 by pamtbaau
7 years ago

Npetri!
You are a rock star!, it works.
Thanks so much
Carlos.

6 years ago

There is no need to create this file. It already exists in the directory system/languages.

What you need to do is to fix a naming bug that prevents Gateway from location this bug. You can to this by applying this GitHub pull request.

Creating an extra copy of this translation makes it harder to maintain the translations for your site.

👍 1

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 3 days ago
2 70 5 hours ago
General · by pamtbaau, 10 hours ago
1 45 10 hours ago
General · by Andy Miller, 22 hours ago
0 43 22 hours ago
General · by Marcel, 12 months ago
6 341 4 days ago
General · by Duc , 5 days ago
3 35 5 days ago