TYPO3-Documentation / render-guides

Render the docs with phpdocumentor/guides
GNU General Public License v3.0
3 stars 6 forks source link

Languages in version selector not sorted alphabetically #358

Open mbrodala opened 7 months ago

mbrodala commented 7 months ago

The version selector includes language variants of the docs. These are currently not sorted by any apparent order:

image

These should at least be sorted alphabetically, so that e.g. 12.4 en-us comes before 12.4 ru-ru.

linawolf commented 7 months ago

@mbrodala if we sort them alphabetically, de-DE would come before en-us. or should we always put english first I wonder?

mbrodala commented 7 months ago

If there ever is de-de then that would be consistent indeed. But at this point the languages should be extracted from the version selector and put somewhere else.

brotkrueml commented 7 months ago

For the records: It is not part of the render-guides, but of the PHP script output that is requested by JavaScript to display it on the docs server via Ajax. The Sphinx-based rendering uses the same script.

linawolf commented 7 months ago

We should be able to interpret the data provided by the Ajax in different ways though?

linawolf commented 7 months ago

We could also adjust the Ajax response here: https://github.com/TYPO3GmbH/site-intercept/tree/develop/legacy_hook

brotkrueml commented 7 months ago

We should be able to interpret the data provided by the Ajax in different ways though?

AFAIR the response is pure HTML, no structured data. This is not a job in JavaScript afterwards.

brotkrueml commented 7 months ago

We could also adjust the Ajax response here: https://github.com/TYPO3GmbH/site-intercept/tree/develop/legacy_hook

This seems to be the sorting part: https://github.com/TYPO3GmbH/site-intercept/blob/develop/legacy_hook/src/DocumentationVersions.php#L166

garvinhicking commented 3 months ago

Closing this; the PR #583 has implemented a better sorting and output for this. If there are any objections or improvements, please feel free to create a follow-up issue! :-)

mbrodala commented 3 months ago

Not sure why we need another issue given that this one is not fixed yet:

image

linawolf commented 3 months ago

We already deployed a solution which is applied on the next rendering of a manual. You can see it tested out here: https://docs.typo3.org/m/typo3/tutorial-getting-started/draft/en-us/

garvinhicking commented 3 months ago

@mbrodala It will only be fixed once a documentation is rendered anew. This does not happen automatically because docs are only rendered when they get new versions.

We'll probably re-render ALL "main" documentations at some point when the PHP-based rendering is stabilized thoroughly.

I'll let @linawolf decide when to close this issue then, because you're probably right that you want to see it before we actually close the issue ;)

mbrodala commented 3 months ago

The draft indeed looks great:

image

If this will be live at some point, I'd be fine for closing this issue. But it's also useful to keep it open as reminder.

mbrodala commented 3 months ago

Micro nitpick: The words "French" and "Russian" should be translated to the according target language.

garvinhicking commented 3 months ago

Micro nitpick: The words "French" and "Russian" should be translated to the according target language.

Yeah the problem is we don't have the language available as metadata for the other versions. And we can only use client-side scripting, not server-side evaluation (thus, no php-isodb). Only what the versionsJson API endpoint gives us (version, singlehtml URL, normal URL, ISO language code like ru-ru). Currently, the resolved language is hardcoded in our javascript file.