This is a quick reference guide for WordPress plugin developers who host their plugin in the WordPress.org repository.
While elaborate documentation is available for each step of the process, I found it fragmented and confusing. This guide will be a snapshot of the process with links to further reading as necessary.
Step 1: Make sure your strings are translatable.
Enclose all translatable strings with WordPress translate functions: __()
or _e()
.
_e() is the same as __(), but instead of returning the string, it echo‘s it. Use __() within printf
or sprintf
to include variables.
__( string $text, string $domain = 'default' )
The first parameter of the function will be the string to translate and the second parameter will be the text domain.
There are few more functions and use cases, refer this guide for all the info.
Which brings us to the next step, your choice of text domain.
Step 2: Make sure your text domain matches your plugin slug in the WordPress.org repository.
If your plugin url in the repository is: https://wordpress.org/plugins/my-plugin
, then your text domain must be my-plugin
.
For plugins hosted on WordPress.org, it’s no longer required to add Text Domain
and Domain Path
in the plugin header. Loading included language files (example) using load_plugin_textdomain
is also no longer required.
Now your plugin is ready for translation. Commit the changes (if any) to WordPress.org repository.
Step 3: Add translations on translate.wordpress.org
Once your translation ready plugin is in the repository, you can add your translations by visiting https://translate.wordpress.org/projects/wp-plugins/my-plugin
(example).
You could add them yourselves, find volunteers to contribute, or hire professionals to translate your plugin for you.
The translations will not be available immediately, but will have a Waiting status until they are approved by someone who can. You can see this in the screenshot above.
Step 4: Add a Project Translation Editor to get your translations approved.
A Project Translation Editor or PTE is someone who is approved by the Polyglots team with the authority to approve translated strings.
- You will need a PTE for each language.
- PTE request can be made by the plugin author, or by a translator themselves.
To make a PTE request (example) as a plugin developer, follow the guidelines here: Plugin/Theme Author Translation Review/PTE Request.
Note that assigning a PTE is not mandatory to get translations approved, you could simply request a translation review. However, having a PTE will make the process much faster in the future, especially if the PTE is someone in your team or someone you have a direct relationship with.
The locale code required to make the PTE request is available here.
If you have personal contact with the translator, then you may request them to leave a comment to the post stating that they are willing to be the PTE for the project (example). This could speed up the process a tiny bit.
What happens next?
From this point on, there isn’t anything you need to do.
- The polyglots team will process your request in due time. Remember, this is a volunteer operation, so do not expect immediate response. Although from experience, some volunteers are very proactive and swift. Just don’t expect it all the time. (Wait at least 3+ weeks before requesting a follow up on the request comments or on #polyglots Slack channel.)
- Once 90% of the strings are translated, a language pack will be created by the repository.
- These language packs will be listed on the right sidebar of your plugin page. Refer screenshot below.
- Then when a website has one of the translated languages set as the Site Language (under General Settings), as below…
- … the corresponding language pack will be downloaded next time any plugin, theme, or WordPress itself is updated.
That’s pretty much all there is. Leave a comment if you are in doubt and I will try to answer. Also refer Internationalization Security doc for some tips and best practices.
If you found this helpful, please give a shoutout on your social channels. Thank you.
Leave a Reply