WordPress / plugin-check

A repository for the new Plugin Check plugin from the WordPress Performance and Plugins Team.
https://wordpress.org/plugins/plugin-check/
GNU General Public License v2.0
266 stars 54 forks source link

Using WordPress translations for i18n calls #795

Closed joho1968 closed 2 hours ago

joho1968 commented 2 hours ago

What is the correct way to utilize already translated strings in the WordPress core?

Using 'default' as the text domain does not seem to work as it generates a warning to the effect of:

Mismatched text domain. Expected 'slug_for_my_plugin' but got 'default'.

(WordPress.WP.I18n.TextDomainMismatch)

Or am I expected to duplicate the translation of the strings in my own plugin? 🤔

ernilambar commented 2 hours ago

Using default textdomain is not recommended but allowed. This has been fixed in the plugin repo. It will be released in new version 1.3 in few days.

swissspidy commented 2 hours ago

What is the correct way to utilize already translated strings in the WordPress core?

You don‘t :-) Unless you really know what you‘re doing. Which is why it‘s only a warning, not an error

Or am I expected to duplicate the translation of the strings in my own plugin?

Ideally yes, this is best for tramslators.