That code change does not affects string translation in any way, I am suggest...

Contribution Date
Technology
Contribution Project
Contribution Details

That code change does not affects string translation in any way, I am suggesting just for the sake of clean code.

so why is it a problem it has a tag included?

You got this right. It has a tag included that is the problem, I mean just code level problem. You can consider this as code refactoring. Using <em> tag instead of % will not affect the purpose of this issue.

I am going to show you an example.

Code 1:

print t('<em>I am translatable</em>');

OR

Code 2:

print t('%translatable_string', array('%translatable_string' => t('I am translatable')));

My opinion choose Code 2, and that is what I am suggesting here.

While I was writing this.. timplunkett answered my query in IRC
<subhojit777> suppose I want to print a string within <em> tags, and also want the string to be translatable, I mean enclose it within t(). What would be the best approach t('<em>Translatable string</em>') OR t('%string', array('%string' => t('Translatable string')))
<subhojit777> I am asking this in reference to this issue https://www.drupal.org/node/2394951#comment-9602489 (this issue)
<timplunkett> subhojit777: no embedding tags is fine
<timplunkett> subhojit777: return t('<em>Edit @type</em> @title', array('@type' => $type_name, '@title' => $entity->label())); is fine
<timplunkett> subhojit777: <em> and <em class="placeholder"> are different
<subhojit777> timplunkett, Is there any significant difference between them, apart from the class
<timplunkett> subhojit777: that, and its harder for translators because they have less context
<timplunkett> <em>Edit @type</em> @title is different than Edit @type

I hope you got what I was trying to make you understand :) I will revert back the old code. Sorry :)

Contribution Author
Files count
0
Patches count
0