getgrav / grav-plugin-langswitcher

Grav LangSwitcher Plugin
https://getgrav.org
MIT License
28 stars 26 forks source link

Default language doesn't appear under certain configurations #67

Closed yankl closed 2 years ago

yankl commented 2 years ago

My experience is that the default language doesn't appear on translated pages when untranslated_pages_behavior is set to hide in the plugin configuration, and the .md file for the default language doesn't include a language extension -- as is the case if, for example, the page was created when include_default_lang_file_extension is set to false in the site config.

A detailed analysis and proposed fix is in the PR below.

godfatherjohn commented 2 years ago

Do I understand this correctly?

Precondition: untranslated_pages_behavior is set to hide

On the website, in the Langswitcher section (e.g. frontend: EN FR IT), the default language (e.g. EN) is not shown in the selection under 'certain conditions'?

As far as I know, the default language entry, e.g. EN, disappears from the Langswitcher section on the frontend upon clicking on a secondary language. Hence, only FR IT is shown, EN is no longer there. At least this is the issue I have stumble upon.

Workaround: If you name the default.md --> default.en.md, EN will be back in the selection on the frontend.

If that is what you are talking about, then I can confirm this issue, stumbled over it two days ago. Grav 1.7.35, LangSwitcher 2.0.1

yankl commented 2 years ago

Yes, that's what I mean, the language code extension not appearing in the .md file name, and untranslated_pages_behavior set to hide causes the link to the default language to not appear on the secondary language pages.

rhukster commented 2 years ago

Please try the latest version of the 'develop' branch. I've rewritten this logic.

godfatherjohn commented 2 years ago

I have tested it and can confirm that this issue is fixed in the current develop branch.

yankl commented 2 years ago

Yes, this issue is resolved for me! However, there seems to be a new regression, unfortunately. See my comment here.