method setLanguage()

This method may be called by the template to change the current output language and/or locale (e.g. en_US).

Its arguments are a list of possible languages. Use func_get_args() to get the argument array. The first known language should be used by your service.

Return language that has been set.

require_once 'PHPTAL/TranslationService.php';

class MyTranslator implements PHPTAL_TranslationService {

    public function setLanguage(){
        $langs = func_get_args();
        foreach($langs as $lang){
            // if $lang known use it and stop the loop
            $this->_currentLang = $lang;
        return $this->_currentLang;
    private $_currentLang;