Use F::app() here to access the $wg style globals, e.g.:

  F::app()->wg->Lang->getCode();