Drupal: t yanlış kullanımı (?)

1 Cevap php

I <strong> etiketleri bir kelime sarmak istiyorum. O t() çağrısı bu hakkı yapmak için, ya da ben bunu başka bir şekilde yapmam gerekiyor doğru mudur?

$help = '<p>' . t("Does this sample data look right for node type %node_type? If not, use your browser's <strong>back</strong> button to fix it on the previous page.", array('%node_type' => $_SESSION[NODE_TYPE_KEY])) . '</p>';

Ayrıca, ne sadece bu gibi doğrudan t() içine değişkenleri düştü?

    foreach ($term_info['term_fields'] as $vocab) {
        $options[$vocab] = t($vocab); // TODO: incorrect use of t()?
    }

1 Cevap

Her ikisi de sorular http://api.drupal.org/api/function/t/6 de Drupal API belgelerinde cevaplandırılır. Kısa bir özeti:

Html etiketleri Eğer gerçekten gerekiyorsa bir kelime kaydırabilirsiniz. Alıntı:

HTML markup within translation strings is allowed, but should be avoided if possible.

Bu not sizin kod parçacığını yapmak gibi) (t içine değişkenleri damla izin verilir. Alıntı:

Because t() is designed for handling code-based strings, in almost all cases, the actual string and not a variable must be passed through t().