Closed strarsis closed 2 years ago
You need to add description for your translated string. WP Codex is clarify in this case https://codex.wordpress.org/I18n_for_WordPress_Developers#Descriptions
For example if your code looks like:
use \App\Services\Validation\SizeRule;
$error = __(
sprintf('Required minimum %d characters', SizeRule::MIN_CHARACTERS)
'text-domain'
);
You need to add translator for this magic %d
for easily translate in feature and keep context.
So my example code need looks like:
use \App\Services\Validation\SizeRule;
/* translators: minimum characters count */
$error = __(
sprintf('Required minimum %d characters', SizeRule::MIN_CHARACTERS)
'text-domain'
);
TLDR: Just add WordPress i18n translate description - by this you can write a "personal" message to the translators, so that they know how to deal with the string.
@Log1x: Should these warnings be ignored and those special comments added afterwards? Or these comments directly added (Sage 10 has the same issue) to the theme repository?
PR for fixing those i18n warnings: https://github.com/roots/sage/pull/3039
Description
wp i18n make-pot
lists warnings when extracting strings from a sage 9 theme:Steps to reproduce
wp i18n make-pot
to extract strings (e.g. asnpm
script).Expected behavior: No warnings emitted from
wp cli i18n
.Actual behavior: Warnings emitted from
wp cli i18n
Reproduces how often: Always.
Versions