/ \copydoc Erebot::Interfaces::Config::Proxy::getTranslator()
518274
public function getTranslator($component)
    {
        if (isset($this->locale)) {
            $domain = str_replace('\\', '_', ltrim($component, '\\'));
            $localedir = static::getBaseDir($component);
            return \Erebot\Intl\GettextFactory::translation($domain, $localedir, array($this->locale));
        }

        if ($this->proxified === $this) {
            throw new \Erebot\NotFoundException('No translator associated');
        }

        return $this->proxified->getTranslator($component);
    }
959139
public function getTranslation($locale = 'en_US', ConnectionInterface $con = null)
    {
        if (!isset($this->currentTranslations[$locale])) {
            if (null !== $this->collTeamI18ns) {
                foreach ($this->collTeamI18ns as $translation) {
                    if ($translation->getLocale() == $locale) {
                        $this->currentTranslations[$locale] = $translation;

                        return $translation;
                    }
                }
            }
            if ($this->isNew()) {
                $translation = new ChildTeamI18n();
                $translation->setLocale($locale);
            } else {
                $translation = ChildTeamI18nQuery::create()
                    ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
                    ->findOneOrCreate($con);
                $this->currentTranslations[$locale] = $translation;
            }
            $this->addTeamI18n($translation);
        }

        return $this->currentTranslations[$locale];
    }
1166652
public function getTranslation($language_id = null)
    {
        /** @var ActiveRecord $translation */

        /** @var \DevGroup\Multilingual\Multilingual $multilingual */
        $multilingual = Yii::$app->multilingual;
        if ($language_id === null) {
            $language_id = $multilingual->language_id;
        }
        /** @var ActiveRecord $owner */
        $owner = $this->owner;
        if ($language_id === $multilingual->language_id && !$owner->isRelationPopulated($this->translationRelation)) {
            $language_id = $multilingual->language_id;
            $translation = $owner->{$this->defaultTranslationRelation};
            if ($translation !== null) {
                return $translation;
            }
        } else {
            // language id specified and it's not default
            $translations = $owner->{$this->translationRelation};
            foreach ($translations as $item) {
                if ($item->language_id === $language_id) {
                    return $item;
                }
            }
        }
        // translation does not exists!

        /** @var ActiveRecord $class */
        $class = $this->getTranslationModelClassName();
        /** @var ActiveRecord $translation */
        $translation = new $class();
        $translation->loadDefaultValues();
        $translation->setAttribute('language_id', $language_id);

        $translations = $this->owner->{$this->translationRelation};
        $translations[] = $translation;

        $owner->populateRelation($this->translationRelation, $translations);


        if ($language_id === $multilingual->language_id) {
            $owner->populateRelation($this->defaultTranslationRelation, $translation);
        }

        return $translation;
    }
654510
private function getTranslation()
    {
        $operatorTranslation = null;
        foreach ($this->entity->getTranslations() as $translation) {
            if ($translation->getLocale() == $this->locale) {
                $operatorTranslation = $translation;
            }
        }
        if (!$operatorTranslation) {
            $operatorTranslation = new OperatorTranslation();
            $operatorTranslation->setLocale($this->locale);
            $operatorTranslation->setOperator($this->entity);
            $this->entity->addTranslation($operatorTranslation);
        }

        return $operatorTranslation;
    }
923633
public function translate($key)
    {
        if ($this->translations === null) {
            $this->loadTranslations();
        }

        if (!isset($this->translations[$key])) {
            // the key if $this is already the fallback translator
            return $this !== self::$fallbackTranslator ? self::$fallbackTranslator->translate($key) : $key;
        }

        return  $this->translations[$key];
    }
197690
public function getTranslator()
    {
        if (!$this->_translator) {

			$this->_translator = new \Zend_Translate(   
				'gettext', 
				CMSROOT . 'lang',  
				$this->_locale,  
				array('scan'=>\Zend_Translate::LOCALE_FILENAME)
			); 

        }
        return $this->_translator;
    }
775393
public function getTransfered()
    {
        $base = log($this->transfered, 1024);
        $suffixes = array(
            '',
            'K',
            'M',
            'G',
            'T',
        );
        return round(pow(1024, $base - floor($base)), 2) . ' ' . $suffixes[floor($base)];
    }
302413
protected function getImportTranslator()
    {
        $translator = parent::getImportTranslator();

        if ($translator instanceof \Gems_Model_Translator_AnswerTranslatorAbstract) {
            // Set answer specific options
            $surveyId = isset($this->formData['survey']) ? $this->formData['survey'] : null;
            $tokenCompleted = isset($this->formData['tokenCompleted']) ?
                    $this->formData['tokenCompleted'] :
                    \Gems_Model_Translator_AnswerTranslatorAbstract::TOKEN_ERROR;
            $skipUnknownPatients = isset($this->formData['skipUnknownPatients']) &&
                    $this->formData['skipUnknownPatients'];
            $noToken = isset($this->formData['noToken']) ?
                    $this->formData['noToken'] :
                    \Gems_Model_Translator_AnswerTranslatorAbstract::TOKEN_ERROR;

            $trackId = isset($this->formData['track']) ? $this->formData['track'] : null;

            $translator->setSurveyId($surveyId);
            $translator->setSkipUnknownPatients($skipUnknownPatients);
            $translator->setTokenCompleted($tokenCompleted);
            $translator->setNoToken($noToken);
            $translator->setTrackId($trackId);
        }

        return $translator;
    }
981558
public function getTranslation($lang, $key, $array_support = false)
    {
        $translation = Grav::instance()['languages']->get($lang . '.' . $key, null);
        if (!$array_support && is_array($translation)) {
            return (string)array_shift($translation);
        }

        return $translation;
    }
170700
private function getNewTranslation($language)
    {
        $translation = null;
        /** @var \yii\db\ActiveQuery $relation */
        $relation = $this->owner->getRelation($this->relation);
        /** @var ActiveRecord $class */
        $class = $relation->modelClass;
        //if ($translation === null) {
        $translation = new $class;
        $translation->{key($relation->link)} = $this->owner->getPrimaryKey();
        $translation->{$this->languageAttribute} = $language;
        //}
        return $translation;
    }
804507
public function translate($text)
    {
        $translator = new Translation(new Client(), $this->config);

        return $translator->translate($text);
    }
40004
public function getTranslation($useFallback = true)
    {
        $attributeTranslation = $this->getTranslationByLocale($this->locale);

        if (!$attributeTranslation) {
            if ($useFallback) {
                // Check if translation exists for fallback locale.
                $attributeTranslation = $this->getTranslationByLocale($this->fallbackLocale);

                // Otherwise check if any translation exists.
                if (!$attributeTranslation && $this->entity->getTranslations()->count() > 0) {
                    $attributeTranslation = $this->entity->getTranslations()->first();
                }
            }

            // If still no translation exists, create an empty object.
            if (!$attributeTranslation) {
                $attributeTranslation = new AttributeTranslation();
                $attributeTranslation->setLocale($this->locale);
                $attributeTranslation->setAttribute($this->entity);

                $this->entity->addTranslation($attributeTranslation);
            }
        }

        return $attributeTranslation;
    }
293620
private function getFileTemplate()
    {
        $content = FormatFileContent::createObject();
        $content->addItem('<?php');
        $content->addItem(
            sprintf(
                '/**Migration file generated at %s on %s by PowerOrm(%s)*/',
                date('h:m:i'),
                date('D, jS F Y'),
                POWERORM_VERSION
            ).PHP_EOL
        );

        $content->addItem('namespace %s;'.PHP_EOL);

        $content->addItem('use Eddmash\\PowerOrm\\Migration\\Migration;');
        $content->addItem('%s');

        $content->addItem('class %s extends Migration{'.PHP_EOL);

        $content->addIndent();
        $content->addItem('public function getDependency(){');

        $content->addIndent();
        $content->addItem('return [');

        $content->addItem('%s');

        $content->addItem('];');
        $content->reduceIndent();

        $content->addItem('}'.PHP_EOL);

        $content->addItem('public function getOperations(){');

        $content->addIndent();
        $content->addItem('return %s ;');
        $content->reduceIndent();

        $content->addItem('}'.PHP_EOL);
        $content->reduceIndent();

        $content->addItem('}');

        return $content;
    }
485772
protected function getTranslation($domain, $context, $original)
    {
        return $this->dictionary[$domain][$context][$original] ?? false;
    }
1046892
function keyTranslate( $key )
    {
        $trans = null;
        for ( $i = 0; $i < count( $this->Handlers ) and $trans === null; ++$i )
        {
            $handler = $this->Handlers[$i];
            if ( $handler->isKeyBased() )
                $trans = $handler->keyTranslate( $key );
        }
        return $trans;
    }
105220
private function _getTranslators($file)
    {
        $subject = file_get_contents($file);
        preg_match_all($this->module->patternArrayTranslator, $subject, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
        $translators = [];
        foreach ($matches as $data) {
            if (isset($data['translator'][0])) {
                $translators[$data['translator'][0]] = true;
            }
        }

        return array_keys($translators);
    }
530485
function getTranslate(): \Closure {
    return function($value, \Mustache_LambdaHelper $helper) {
      $defaultArgs = [
        'category' => $this->defaultCategory,
        'language' => null,
        'params' => []
      ];

      $output = trim($value);
      $isJSON = mb_substr($output, 0, 1) == '{' && mb_substr($output, mb_strlen($output) - 1) == '}';

      if ($isJSON) $args = $this->parseArguments($helper->render($value), 'message', $defaultArgs);
      else {
        /** @var string[] $parts */
        $parts = explode($this->argumentSeparator, $output, 2);
        $length = count($parts);
        if (!$length) throw new InvalidCallException('Invalid translation format.');

        $args = ArrayHelper::merge($defaultArgs, [
          'category' => $length == 1 ? $this->defaultCategory : rtrim($parts[0]),
          'message' => ltrim($parts[$length - 1])
        ]);
      }

      return \Yii::t($args['category'], $args['message'], $args['params'], $args['language']);
    };
  }