Hello fox
I’m all new to Grav, I realy like it.
But I’m facing an issu for the 10 past hours, I tryed to solved it using AI, but I hope regular old brain might help me better
My problem is about multilanguage FR | EN
Website is monacophotographer.com
I have been changing all the setting I could in sytem.yalm
I have created pages in both language, in the admin pannel I can see both language and select each language
in the folders I have tried mayny combinaison (only 2 at the same time)
default.md
default.en.md
default.fr.md
when I’m in a page in the menu, I can’t swop to the same page in the other language it keep on going back to the home in the default language
I have tried degeug with
PAGE LANGS: {{ page.languages|json_encode(constant(‘JSON_PRETTY_PRINT’)) }}
but I always get PAGE LANGS: null
it looks like both pages are not married together, but in the admin> page they are together.
I have put the change language menu ,
But it keeps putting the active URL in the other language menu
-
{% for lang in config.system.languages.supported %}
-
{% if lang == grav.language.getActive %}
{{ lang|upper }}
{% else %}
{# TENTATIVE 1 : La méthode propre (Traductions liées) #}
{% set target = page.translations\[lang\] %}
{# TENTATIVE 2 (Secours) : On cherche par le dossier physique #} {# On reconstruit l'URL manuellement si Grav est perdu #} {% if not target %} {# On suppose que la page FR a le slug du dossier ou son propre slug #} {# C'est une astuce : on force le switch de langue sur l'URL courante #} {# ATTENTION : Cela marchera uniquement si le slug est identique ou si on redirige vers la racine du dossier #} {% endif %} {% if target %} <a href="{{ target.url }}">{{ lang|upper }}</a> {% else %} {# DERNIER RECOURS : On renvoie vers l'accueil de la langue pour ne pas faire de lien mort #} <a href="{{ base_url_simple }}/{{ lang }}">{{ lang|upper }}</a> {% endif %} {% endif %} </li> {% if not loop.last %}<li>|</li>{% endif %} {% endfor %} </ul>If any are used to multi language I hope you will be able to help
All the best
Lawrence