WP Translation Playground

When translating plugins or themes, it can be hard to know the context in which the stringString A string is a translatable part of the software. A translation consists of a multitude of localized strings. appears. In GlotPressGlotPress GlotPress is the translation management software that powers Translate.WordPress.org. More information is available at glotpress.org., we’ve got the table view for translations where there is very little context. Sometimes you can use the “References” to find the right line in code and try to guess context from code.

Our work on Local GlotPress, as announced in February, is an attempt to bring GlotPress translation to your local blog by making use of the currently installed plugins or themes. You can load their translations into the Local GlotPress, make changes, and deployDeploy Launching code from a local development environment to the production web server, so that it's available to visitors. the translations back into WordPress to see them right away.

Additionally, Local GlotPress features inline translation: when viewing the interface with the (partially) translated stringsString A string is a translatable part of the software. A translation consists of a multitude of localized strings., the strings can be translated in-place. Colors indicate the availablility of inline translation for the particular text.

Now, combining Local GlotPress with the WordPress Playground (see also the lately announced Tech Demos on the CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. P2p2 "p2" is the name of the theme that blogs at make.wordpress.org use (and o2 is the accompanying plugin). When asked to post something "on the p2" by a member of the Polyglots team, that usually means you're asked to post on the team blog https://make.wordpress.org/polyglots/. and this overview post at web.dev) allows you to make use of the above without having to set up anything.

Making Quick In-Context Translation Possible

Since WordPress Playground a kind of a virtual machine running WordPress, just in your browser, we can use it together with Local GlotPress to make translation any pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party or theme much easier:

You open the Playground via the link on the top right, and it will load a WordPress with that plugin activated, plus Local GlotPress. You can then navigate to the plugin’s screens and add your translations.

Remember that this is a sandbox! If you reload the page, all your translations will be gone. So make sure to “Contribute back,” i.e. submit the translations to translate.wordpress.orgtranslate.wordpress.org The platform for contributing to the translation of WordPress core, themes and plugins..

Go to GlotPress > Contribute back > Sync to WordPress.org and then submit the form to open a new window. It should take you back to translate.wordpress.org and say “x translations added” which means that your translations have been sucessfully transmitted.

Should things fail, you can also download a PO file of your translations from that screen and then try to import it manually.

Afterwards, you can confirm your submission by opening the playground again. As it will take the most current (and waiting) translations from translate.wordpress.org, your new translations should be displayed.

Try the Translation Playground today

See the screens below for a preview of what this looks like or to quickly try one yourself, for example the WordPress Playground for the Friends plugin in German.

The above is just an example link, it is enabled for any other plugin/theme and language. Some work better than others, and larger plugins with many translations tend to load slower but usually it should only take a few seconds to load.

Booting up WordPress

Screenshot 2023-04-19 at 09.28.03

In-context translation (right click the colored text)

Screenshot 2023-04-19 at 09.28.33

Translation is displayed in place after adding it

see-translation-in-context

Submit back to translate.wordpress.org

contribute-back

Summary

We think that the WP Translation Playground is a new and exciting way to translate plugins and themes but also to verify that translations work well in context. It also allows you translate the most important strings first: the ones that you see.

Path forward

There is certainly still room for improvement and iteration (there are a number of pending pull requests) and we’re curious for your opinions and experiences. Please give us feedback in the comments!

Thank you @amieiro and @spiraltee for reviewing this draft and your collaboration on this feature, and @zieladam for creating the WP Playground!

#local-glotpress #playground