Prev |  | Next

### 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.

                <?php
    class MyTranslator implements PhpTal\TranslationServiceInterface {
    …
        public function setLanguage(){
            $langs = func_get_args();
            foreach($langs as $lang){
                // if $lang known use it and stop the loop
                $this->_currentLang = $lang;
                break;
            }
            return $this->_currentLang;
        }
        …
        private $_currentLang;
    }
    ?>

Prev | Up | Next
interface `PHPTAL_TranslationService` | Home | method `useDomain( `$domain`)`