The following code:

$report .= '<p>' . t('<strong>%percentage</strong> of <strong><em>'.$node_type_get_types[$type]->name.'</em></strong> completed.', array('%percentage' => $percentage)) . ' ' . $count . '</p>';

is inside of iteration, because I need to make the same calculations and collect all the results and output all in one string.

Drupal.org's automated testing complains about the above part:

Concatenating translatable strings is not allowed, use placeholders instead and only one string literal

I don't have any idea how to make this correct.

1 Answer 1


It means you have to use a placeholder, in the same way you used the %percentage placeholder.

$report .= '<p>' . t('<strong>%percentage</strong> of <strong><em>@content-type</em></strong> completed. %count', array('%percentage' => $percentage, '@content-type' => $node_type_get_types[$type]->name, '%count' => $count)) . '</p>';

I used a @-placeholder for the content type, in the same way done from node_add().

For a list of the placeholder types used from Drupal, see format_string(). The documentation for t() explain in details why concatenating is not possible in translatable strings.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.