t

5.x misc.inc t($str, $vars = array())
4.x misc.inc t($str, $vars = array())

This function will facilitate translations by using hook_translate()

Allows variable replacements. Use like this: t("@name's blob", array("@name" => "Richard")); or simply t("My blob"); if you don't need replacements.

Not implimented yet.

232 calls to t()
admin_add_degree_form in modules/admin/admin.degrees.inc
This form lets the user add a degree to the database.
admin_add_degree_form_submit in modules/admin/admin.degrees.inc
Submit handler for the add_degree_form.
admin_add_degree_form_validate in modules/admin/admin.degrees.inc
Validate handler for add_degree_form
admin_advising_settings_form in modules/admin/admin.module
This is a systems settings form, which lets the user edit advising variabled for FlightPath.
admin_apply_draft_changes_form in modules/admin/admin.module
This form lets the user apply draft changes (if they can supply the passcode)

... See full list

File

includes/misc.inc, line 1234
This file contains misc functions for FlightPath

Code

function t($str, $vars = array()) {

  // Note: at the moment, this isn't being used, but should one day be set.  
  @$langcode = isset($langcode) ? $langcode : $GLOBALS["fp_system_settings"]["language"];

  // First, change $str if any other modules implement hook_translate().
  invoke_hook("translate", array(&$str, $langcode)); // str is passed by ref, so no return needed.

  if (is_array($vars) && count($vars) > 0) {
    foreach ($vars as $var => $val) {

      // If var begins with %, it means we want to italicize the val.
      if (strstr($var, "%")) {
        $val = "<em>$val</em>";
      }

      $str = str_replace($var, $val, $str);
    }
  }

  return $str;
}