WordPress / wporg-theme-directory

15 stars 6 forks source link

New block: "Available translations" to list other translations for a theme #72

Closed ryelle closed 3 months ago

ryelle commented 3 months ago

Fixes #28 — This adds a new block into the "Translations" section of the single theme sidebar, to list out all of the available languages for a given theme.

This is similar to what's on plugins, but I intentionally did not put it behind a dropdown (we can't reuse the plugins one, and it's not a true modal anyway). TBH I think having the full list is a good indicator of "theme health" — if a theme has been translated into many languages, people clearly thought it was worth translating for whatever reason.

Screenshots

On a theme with many translations (Twenty Nineteen).

theme-many-translations

On a theme with a few translations.

theme-few-translations

On a theme with no translations. No message appears when viewing from the English site, just the "translate" link.

theme-no-translations

Same theme, but viewed from a Rosetta site, links back to the main English site. No message about it not being supported in whatever you're viewing from, but the banner takes care of that with "This theme is not translated into Español yet. Help translate it!"

theme-no-translations-es

How to test the changes in this Pull Request:

Requires a sandbox for the locale database.

View a theme with active translations, they should be linked in the sidebar. Clicking the link takes you to the theme page on that Rosetta site.

jasmussen commented 3 months ago

This is similar to what's on plugins, but I intentionally did not put it behind a dropdown (we can't reuse the plugins one, and it's not a true modal anyway). TBH I think having the full list is a good indicator of "theme health" — if a theme has been translated into many languages, people clearly thought it was worth translating for whatever reason.

Happy to try this. The particular example is a bit long, so that is indeed the first instinct, the main concern, I suppose, would be cases where the sidebar ends up being longer than the main content column. Though that would, to your point, be a curious theme, successful in translations despite barely any description.

In any case, this seems like a collapsible we can make at a later time, if the need presents itself, so I can go either way on this one.

ryelle commented 3 months ago

For a little more reference, while Twenty Nineteen is translated into 63 languages, only 25 themes have >50 languages, so it is an extreme case. Most themes that have translations have <5.

In any case, I'll merge this and if it seems off in practice we can revisit a collapsible view.