This is a follow-up to this question on setting contexts using t().

I am attempting to set a context using t().

I am trying to set the context for the translation of State to geo. My code looks like this:

$format['locality_block']['administrative_area'] = array(
  '#title' => t('State', array('context' => 'geo')),
  '#size' => 10,

This doesn't give any errors but it also doesn't create the translation unit with the context, either. Any clue what I'm doing wrong? (It's probably something obvious; I'm not good with PHP.)


1 Answer 1


The second argument of the t() function are the replacements and not options.

  • 1
    For those like me who struggle with PHP, here is the code I used that worked; '#title' => t('State', array(), array('context' => 'geo')), May 24, 2012 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.