How to Submit Your First Plugin Translation

Submit a second language translation to each plugin you list on wordpress.org.

Why?

Once a plugin has a translation, the “Languages:” section appears with a link “Translate into your language.” This link helps strangers using your plugin submit more translations. Plugins with one language do not have this link on their .org directory pages.

If you speak only English like me, you can likely produce an English (UK) translation of your plugin to provide a second language for your plugin.

I also hired a translator

I met someone on twitter who charges four cents per word for English to Spanish translation. WordPress recognizes 14 Spanish language variants. My translator said they would prepare a LATAM (Latin American) Spanish that would also work for other variants. I submitted the translation I bought for all variants, but one or two versions have been approved after 6 months. Many uploaded translation files sit behind tens of thousands of other contributions in queues waiting for review. The WordPress project is in dire need of translation volunteers.

How

  1. Export the “all current” file from https://translate.wordpress.org/projects/wp-plugins/embed-pdf-gravityforms/stable/en-gb/default/. Replace the plugin slug “embed-pdf-gravityforms” in this URL with your own.
  2. Open the file in VS Code, and populate all translated strings with the untranslated strings using regex find replace
    Find: msgid “([^”]+)”\nmsgstr “”
    Replace: msgid “$1″\nmsgstr “$1”
  3. Make these replacements manually on the “msgstr” lines:
    1. Color > Colour
    2. Zip, Zip Code > Postcode
    3. Customizer > Customiser
    4. Check > Cheque (if referring to a paper form of payment, not “check this out”)
  4. Make sure the .po file is valid with msgcat {filename}
  5. Import the file on the same page where you got the Export using the Import link.
  6. Wait for someone to approve the translations you’ve submitted (<24 hours, 6 months, or longer depending on the language)

Get word count from .po file

I found this tool helpful when pricing projects with a translator.

https://pofile.net/free-po-editor

How to duplicate a .po file for all Spanish variants

I wrote this PHP script to copy an es_MX/Spanish (Mexico) .po file into the 13 other Spanish variants.

How to test a .po file before publishing on translate.wordpress.org

  1. Put the .po file in the /languages folder of your plugin unless a different path is specified in the plugin’s load_plugin_textdomain() call.
  2. Use the load_textdomain_mofile filter to load your files https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/#plugins-on-wordpress-org
  3. Call wp_set_script_translations() for each of your script files on the admin_enqueue_scripts hook priority 1000
  4. Run the wp-cli command wp i18n make-json languages/
  5. Navigate to Settings > General > Site Language and select from the list of available languages the one you’d like to test.

Where to get feedback about translation compatibility and imports

In the core WordPress slack, there are two channels filled with automated messages about plugin translations. Search for your plugin slug in the Making WordPress slack and look for results in these channels:

  • #polyglots-warnings logs translation warnings generated on translate.wordpress.org when .po files are imported.
  • #meta-language-packs logs language pack notices as plugins are updated.

These channels will tell you if your plugin is not yet compatible with language packs and if anomalies were found while comparing translations.

Sample messages

I found both of these messages to be helpful when working on translations.

  • Plugin is not compatible with language packs: Requires WordPress 4.0; wrong text domain in header
  • Warning: Lengths of source and translation differ too much.

Why aren’t submitted translations showing up in the plugin directory?

Volunteers must review all translated strings. 90% of a plugin’s strings must be translated before that language pack becomes available in the Plugin Repository. Visit this page to monitor progress: https://translate.wordpress.org/projects/wp-plugins/embed-pdf-gravityforms/stable/


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *