activity/translator/translator.php
public function translateActivityToken($token, ComActivitiesActivityInterface $activity)
    {
        if (is_string($token))
        {
            $tokens = $this->getActivityTokens($activity);

            if (isset($tokens[$token])) {
                $token = $tokens[$token];
            }
        }

        if (!$token instanceof ComActivitiesActivityObjectInterface) {
            throw new RuntimeException('Invalid token');
        }

        $result = $token->getDisplayName();

        if ($token->isTranslatable())
        {
            if ($activity->getLocale() == $this->getLocaleFallback())
            {
                // Use decorator catalogue instead
                $this->_switchCatalogues();
                $result = $this->translate($result);
                $this->_switchCatalogues();
            } else $result = $this->translate($result);
        }

        return $result;
    }
public function translateActivityToken($token, ComActivitiesActivityInterface $activity)
    {
        if (is_string($token))
        {
            $tokens = $this->getActivityTokens($activity);

            if (isset($tokens[$token])) {
                $token = $tokens[$token];
            }
        }

        if (!$token instanceof ComActivitiesActivityObjectInterface) {
            throw new RuntimeException('Invalid token');
        }

        $result = $token->getDisplayName();

        if ($token->isTranslatable())
        {
            if ($activity->getLocale() == $this->getLocaleFallback())
            {
                // Use decorator catalogue instead
                $this->_switchCatalogues();
                $result = $this->translate($result);
                $this->_switchCatalogues();
            } else $result = $this->translate($result);
        }

        return $result;
    }
public function translateActivityToken ( $ token , ComActivitiesActivityInterface $ activity ) { if ( is_string ( $ token ) ) { $ tokens = $ this -> getActivityTokens ( $ activity ) ; if ( isset ( $ tokens [ $ token ] ) ) { $ token = $ tokens [ $ token ] ; } } if ( ! $ token instanceof ComActivitiesActivityObjectInterface ) { throw new RuntimeException ( 'Invalid token' ) ; } $ result = $ token -> getDisplayName ( ) ; if ( $ token -> isTranslatable ( ) ) { if ( $ activity -> getLocale ( ) == $ this -> getLocaleFallback ( ) ) { // Use decorator catalogue instead $ this -> _switchCatalogues ( ) ; $ result = $ this -> translate ( $ result ) ; $ this -> _switchCatalogues ( ) ; } else $ result = $ this -> translate ( $ result ) ; } return $ result ; }
Translates an activity token.

@param string|ComActivitiesActivityObjectInterface $token    The activity token.
@param ComActivitiesActivityInterface              $activity The activity object.
@return string The translated token.
Translates an activity token .