使用sprinft()和嵌套变量 - 如何?

I'm trying to translate WordPress website using gettext(). Documentation says this:

Use format strings instead of string concatenation —sprintf(__('Replace %1$s with %2$s'), $a, $b); is always better than __('Replace').$a.__(' with ').$b;

I want to follow this advice but here comes the problem:

<?php _e('You must be', 'textdomain'); ?> 
    <a href="<?php bloginfo('url'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">
        <?php _e('logged in', 'textdomain'); ?>
    </a> 
<?php _e('to post a comment.', 'textdomain'); ?>

This would either require some nested sprintf() or I would have to leave it like that - split into 3 strings (or at least 2). I'm not PHP expert, so if someone knows a way to get around this I would appreciate it.

<?php
sprintf(_e('You must be <a href="%s">logged in</a> to post a comment.', 'textdomain'), bloginfo('url') . '/wp-login.php?redirect_to=' . the_permalink());