Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add language switcher to Learn WordPress for UI translations #187

Closed
varlese opened this issue Feb 2, 2021 · 4 comments
Closed

Add language switcher to Learn WordPress for UI translations #187

varlese opened this issue Feb 2, 2021 · 4 comments
Labels
[Component] Learn Plugin Website development issues related to the Learn plugin. [Component] Learn Theme Website development issues related to the Learn theme. [Type] Enhancement New feature request for the Learn website.

Comments

@varlese
Copy link
Collaborator

varlese commented Feb 2, 2021

All static strings for Learn WordPress are currently available for translation via GlotPress. To be able to display these strings on the front-end of the Learn WordPress site, can we implement a language switcher like the one available on https://wp15.wordpress.net/?

The language switcher should show all locale variants that have 90% or more of the strings translated. (This percentage mimics the threshold for language packs for plugins and themes.) Locales with a smaller amount of strings translated, then, can be hidden from the language switcher to help filter available languages for visitors to the site.

Likewise, adding the ability to search for a language like the example language switcher will help filter choices for site visitors as the number of translated locales increases. We might also want to add the locale abbreviation for clarity, as well - i.e. Français (fr_FR).

language switcher

Related discussion (Polyglots P2).

@coreymckrill coreymckrill added [Component] Learn Theme Website development issues related to the Learn theme. [Component] Learn Plugin Website development issues related to the Learn plugin. [Type] Enhancement New feature request for the Learn website. labels Feb 4, 2021
@tobifjellner
Copy link

tobifjellner commented Feb 6, 2021

...90% or more of the strings translated. (This percentage mimics the threshold for language packs for plugins and themes.)

On meta projects, translations are usually applied string-by-string. Then there's a delay, consisting of a cron-task for committing changes plus waiting for next deploy. (If there are no commits made for several days, and thus no deploys, then translations won't propagate.)
I'd vote for NOT setting a threshold of 90%. If at least one string is translated, then I'd say that the language is established. (Perhaps, though, it could get some kind of "badge" at the top "This UI is translated to __% and contains some strings in English. You can contribute to the translation at ______(link to language-specific translation project)".

@varlese
Copy link
Collaborator Author

varlese commented Feb 8, 2021

My one concern about not setting a threshold is that experience could come across as a little buggy (namely, when you click on the language switcher, if there are only a few strings translated it might seem like nothing changed). Including some sort of badge/tooltip with a call to action, however, sounds like it could both address that and encourage contributions, which I'm a fan of 😄

Perhaps we can start with implementing the switcher for any language with 1 < strings translated, and then, as a second step, see if we can get some design input for tooltip ideas.

coreymckrill added a commit that referenced this issue Apr 7, 2021
This adds a script that retrieves taxonomy term names and descriptions from Learn WP via the REST API and writes them to a file that can get picked up by the pot file generator. This way the terms will get imported into the learn-wordpress translation project and can get translated by community volunteers.

This new script will get run by a scheduled GitHub action and committed directly back to this repo. The generated file is outside of the wp-content directory, so it should never end up being committed to SVN or otherwise make an appearance on the production server.

This also adds the filter to dynamically translate term names and descriptions when they are output on the front end, and adds a notice on term edit screens so users know that the strings will get translated.

Refs #187
coreymckrill added a commit that referenced this issue Apr 8, 2021
…ranslated (#202)

Adds a locale switcher as a wp.org mu-plugin. It lives up in the Admin Bar at the top of the screen, which shows on the front end of Learn (and other wp.org sites) even if the visitor isn't signed in. The reasoning for putting the switcher here is:

* It will be in the same place on every page. If it was lower down within the site header, it would have to be in a different place on the homepage than on internal pages.
* It is reusable across all wp.org sites, should we have other places in the future where it makes sense to use it (and we have sufficient translation).

The switcher uses WP/Gutenberg's native Combobox component for selecting the locale, rather than the select2 JavaScript library (or the selectWoo variant). The hope is that this will be both more accessible and more maintainable, since the future of development for select2/selectWoo is uncertain.

This also adds a dismissible notice to the Learn theme right beneath the site header that shows when a chosen locale has less than 90 percent translation coverage. The notice explains the situation and provides links to the translation project where a visitor could add translations for their chosen locale if they want to.

Refs #187
@hlashbrooke
Copy link
Collaborator

@coreymckrill Can this issue be closed now? The local switcher is live and looks like it works well, but I might be missing something.

@coreymckrill
Copy link
Contributor

Hmm, yep, I think this can be closed. Not sure now why I kept it open...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] Learn Plugin Website development issues related to the Learn plugin. [Component] Learn Theme Website development issues related to the Learn theme. [Type] Enhancement New feature request for the Learn website.
Projects
None yet
Development

No branches or pull requests

4 participants