I am localizing some PHP/XHTML using the gettext()
function in a WordPress plugin. WordPress has 'aliases' for these functions such as __()
and _e()
, the latter of which automatically echoes the arguments.
Now, most of my localization has gone pretty straightforward, such as:
<h3><?php _e('Authentication', 'domain'); ?></h3>
However, I am wondering what to do in the following situation:
<p>
<strong>Note</strong>: Be <em>sure</em> not to mix them up! The public and private keys are not interchangeable!
</p>
As you can see, XHTML is mixed into the message for emphasis of certain words. I am wondering how I should go about localizing this. I could of course remove the strong and emphasis tags to make this a lot easier, but is that really necessary when localizing? There's no way to create this form of emphasis? I would imagine one way of localizing this woul开发者_运维问答d be to use printf or some variation of it, but I am not really sure on the details. Or should I just include the XHTML in the localized string?
Thanks!
Why don't you do something like this?
<p>
<strong><?= _('Note', 'domain'); ?></strong>: <?= _('Be <em>sure</em> not to mix them up! The public and private keys are not interchangeable!', 'domain'); ?>
</p>
精彩评论