Open ocean123 opened 8 years ago
Installed on a Grav with the language enabled (e.g. in system.yaml:
languages:
supported:
- it
include_default_lang: false
translations: true
translations_fallback: true
the months will be translated, IF the months translation is available in Grav. You don't mention which language you want. Check your language file in https://github.com/getgrav/grav/tree/develop/system/languages contains MONTHS_OF_THE_YEAR translation
languages:
supported:
- nl
include_default_lang: false
translations: true
translations_fallback: true
session_store_active: false
http_accept_language: true
override_locale: false
And still english text
I can see
?? strange.
Post your plugin configuration, user/config/plugins/archives.yaml
so I can try with your settings.
enabled: true
built_in_css: true
date_display_format: 'D, m M Y'
show_count: true
limit: 12
order:
by: title
dir: desc
filter_combinator: or
filters:
category:
- blog
- portfolio
- review
But the posts are also not translate. Oct ==> Okt I thinks its more getgrav issue then a achive issue
Are you using the latest release of this plugin?
The plugin latest release is currently supposed to print a list with format <Monthname> <Year>
, correctly translated.
Because of a bug I just noticed, it will just use that format, and not use the format set in the plugin options, was a recent PR side-effect which I'm going to fix.
As for the blog post date, that's another thing. That's handled by the theme, which might not be using the translation functionality. Which theme is that?
Archive version 1.4.0.
About the theme and the date. Its happening in Gravstrap-theme but also in Antimatter All plugins and Grav are up-to-date.
Yes Antimatter is not translating the date currently. Am trying to look how the dates can be translated automatically based on the language.
The date format of the Archives plugin should be like this: http://gravstrap.diblas.net/my-gravtastic-blog Am out of ideas why it's in that format and not translated.
I deletet the config file for achive. Now the format is fine. Just the translation is still not okey
After just opening the plugin. Click on save without changing any thing I get this
So, this is an issue caused by the blog-injector
plugin, installed in the Gravstrap skeleton.
I checked it because it was too strange.
That plugin overrides this Archives plugin output (and other plugins output too) in https://github.com/giansi/grav-plugin-blog/blob/master/templates/blog/bootstrap/blog_theme.html.twig#L160-L178, thus causing a bit of an issue here, because the output is different, causing this confusion.
Meanwhile I added a PR to Grav to allow translating dates automatically, so even in this case the date should be automatically translated based on the locale.
thanks a lot :+1:
@flaviocopes I have encountered the same issue as above using the Sora Article template. Saving the plugin's settings in Admin with no change except limit: 24 caused each date to list separately instead of being collected into months. An uninstall and reinstall of the plugin did not restore grouping by month. This template does not have/use a "blog injector" plugin, Other places to look? All latest updates applied. What is changed by simply saving the plugin settings?
Issue is fixed by pull request #7 that fixes blueprints.yaml submitted February, a year ago. Please commit!
Unfortunately a late report. I think since GRAV 1.3 update the translation is broken. Up to then it worked perfectly for the months. I could not find what changed that could be the reason for this.
As a summary, for now until it gets fixed what is the solution to get the translation working in the archives section?
This issue is still reproduced on Grav v1.5.8 with Archives v1.5.1 and without BlogInjector installed.
I found two solutions:
<span class="archive_date">{{ month|localizeddate('none', 'none', 'ru', 'Europe/Moscow', 'LLLL y')|capitalize }}</span>```
the latest version of grav is not working with the MONTHS_OF_THE_YEAR
tanslation
I checked the translations located in grav/system/languages/[lang].yaml
and they are presented there
I don't want to change the twig template like the solution above because it will break when grav do an upgrade
Needs help
It's true this plugin is not using the Grav translation strings, as it's just using PHP date format strings, and those translations are going to be powered by the php_intl
extension.
Please make sure you have this installed.
If you, like me, updated Grav from 1.5 to 1.6 and saw this:
All you need to do is open your theme's Twig file: user/themes/<Theme>/templates/partials/archives.html.twig
And replace MONTHS_OF_THE_YEAR
with GRAV.MONTHS_OF_THE_YEAR
. Then everything works again:
Found this in the updated documentation (thanks for keeping it up-to-date!)
Any working solution for Grav v1.6.15 and Archives v1.6.0 ?
Almost 5 years passed since opened issue!
Any workaround?
{{ month|date(config.plugins.archives.date_display_format) }}
returns English date format.
{{ 'GRAV.MONTHS_OF_THE_YEAR'|ta(post.date|date('n') - 1) }} {{ post.date|date('d') }}
doesn't use GRAV.MONTHS_OF_THE_YEAR
What works for me, as a workaround is: {{ 'GRAV.MONTHS_OF_THE_YEAR'|ta(month|date('n') -1) }} {{ month|date('Y') }}
If you see no difference (like me while testing) make sure there is no archives.html.twig in user/themes/yourtheme/templates/partials/ respectively alter it there.
@eisenherzz there is another solution, which forum member suggested yesterday: https://discourse.getgrav.org/t/archives-translating-the-date/9435/6
What works for me, as a workaround is: {{ 'GRAV.MONTHS_OF_THE_YEAR'|ta(month|date('n') -1) }} {{ month|date('Y') }} If you see no difference (like me while testing) make sure there is no archives.html.twig in user/themes/yourtheme/templates/partials/ respectively alter it there.
Thank you! That's the only solution that works for me. Grav v1.7.7
I'm a new user and this bug does not just affect archives but all dates in the front-end. I don't really want to twerk something in code. This often leads to problems later on when the bug if officially fixed.
I'm using Grav 1.7.23 and Antimatter (all other themes have the same bug)
Language is set to German, everywhere. Page itself is German, same with admin-panel.
-> should be OKT in German.
So could cou please keep me updated when this will be fixed by a Grav developer? I really wonder that this bug is open since 5 years.
Same issue here in Germany.
Still an issue after 6 years...
Another dirty workaround that works for us in Quark theme is to force date_display_format
= Y-m
(would be easier with #37) and modify archives.html.twig like below:
- <a href="{{ base_url }}/{{ config.plugins.archives.taxonomy_names.month }}{{ config.system.param_sep }}{{ month|date('M_Y')|lower|e('url') }}">
+ <a href="{{ base_url }}/{{ config.plugins.archives.taxonomy_names.month }}{{ config.system.param_sep }}{{ month|date(config.plugins.archives.taxonomy_values.month)|lower|e('url') }}">
{% if archives_show_count %}
<span class="label label-rounded label-primary">{{ items|length }}</span>
{% endif %}
- <span class="archive_date">{{ month|date(config.plugins.archives.date_display_format) }} </span>
+ <span class="archive_date">{{ 'GRAV.MONTHS_OF_THE_YEAR'|ta(month|date('n') - 1) }} {{ month|date('Y') }}</span>
Hi,
how can I translate the months? its now in English, we want it in the local language
best regards