{@inheritDoc}

@return TranslatePlural
556693
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $services = $serviceLocator->getServiceLocator();
        /* @var $translator \Zend\Mvc\I18n\Translator */
        $translator = $services->get('MvcTranslator');

        return new TranslatePlural($translator);
    }
1277682
public function t($key, array $options = [], $locale = null)
    {
        return $this->translate($key, $options, $locale);
    }
331096
public static function GetInstance() : Translator
   {

      if ( null === self::$_instance )
      {
         self::$_instance = new Translator();
      }

      return self::$_instance;

   }
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];
    }
595125
public function getTranslation($lang)
    {
        // Check if locale given
        if (strpos($lang, '_')) {
            $parts = explode('_', $lang);
            $lang = array_shift($parts);
        }

        foreach ($this->getTranslations() as $translation) {
            if ($translation->getLang() === $lang) {
                return $translation;
            }
        }

        $translation = new LayoutTranslation($lang);
        $translation->setLayout($this);

        return $translation;
    }
789541
public function compile()
    {
        $translator = $this
            ->checkNamespace($this->configuration)
            ->checkAlias($this->configuration)
            ->checkMethods($this->configuration)
            ->createTranslator();

        return $translator;
    }
569712
public function getTranslator()
    {
        if (null === $this->_translator) {
            $serviceLocator = $this->getServiceLocator();
            if ($serviceLocator->has('Translator')) {
                $this->setTranslator($serviceLocator->get('Translator'));
            }
        }

        return $this->_translator;
    }
921432
public function getTranslation($id, $parameters = [], $locale = null)
    {
        $parameters = array_merge($this->replacementPatterns, $parameters);

        return $this->translator->trans($id, $parameters, null, $locale);
    }
385745
private function getTranslationFactory($resource, ContainerBuilder $container)
    {
        $translation = null;

        foreach ($container->getDefinition('lug.resource.'.$resource)->getMethodCalls() as $methodCall) {
            if ($methodCall[0] === 'addRelation' && $methodCall[1][0] === 'translation') {
                $translation = $container->getDefinition((string) $methodCall[1][1])->getArgument(0);
            }
        }

        return new Reference('lug.factory.'.$translation);
    }
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']);
    };
  }
730745
protected static function translate($key)
    {
        if (is_callable(static::getTranslatorFunction())) {
            $translated = call_user_func(static::getTranslatorFunction(), $key);
            if ($key !== $translated) {
                return $translated;
            } else {
                return '';
            }
        } else {
            return '';
        }
    }
306666
private function getTranslation()
    {
        $filterTranslation = null;
        foreach ($this->entity->getTranslations() as $translation) {
            if ($translation->getLocale() == $this->locale) {
                $filterTranslation = $translation;
            }
        }
        if (!$filterTranslation) {
            $filterTranslation = new FilterTranslation();
            $filterTranslation->setLocale($this->locale);
            $filterTranslation->setFilter($this->entity);
            $this->entity->addTranslation($filterTranslation);
        }

        return $filterTranslation;
    }
496399
public function t()
  {
      $args = func_get_args();
      $locales = count($this->supportedLocales);

      if (empty($args)) {
          return '';
      }

      if ($locales == 0) {
          return '';
      }

      if ($locales != count($args)) {
          $args = array_slice($args, 0, $locales);
      }

      if ($locales - count($args) > 0) {
          $args = array_merge($args, array_fill(0, $locales - count($args), ''));
      }

      $translations = array_combine($this->supportedLocales, $args);

      return $translations[$this->currentLocale];
  }
925316
public static function translateLayout(LayoutInterface $template, $locale, TranslatorInterface $translator = null)
    {
        if (null === $template->getTranslationDomain()) {
            $template = $template->getTranslation($locale);
        } elseif (null !== $translator) {
            static::injectTranslatorValues($translator, $template);
        }

        return $template;
    }
633805
public function translate($locale) {
		$localeEntity = clone $this;
		$localeEntity->setLocale($locale);
		if(isset($this->data['translations'][$locale]))
			$localeEntity->_set($this->data['translations'][$locale]);
		unset($localeEntity->data['translations'][$locale]);
		$localeEntity->data['translations'][$this->getLocale()] = $this->data['properties'];

		return $localeEntity;
	}
379039
protected function translateUpdate()
    {
        $build = 'update ' . $this->escapeTable() . ' set ';

        // add the array values.
        foreach ($this->attr('values') as $key => $value) {
            $build .= $this->escape($key) . ' = ' . $this->param($value) . ', ';
        }

        // cut away the last comma and space
        $build = substr($build, 0, -2);

        // build the where statements
        if ($wheres = $this->attr('wheres'))
        {
            $build .= $this->translateWhere($wheres);
        }
    
        // build offset and limit
        if ($this->attr('limit'))
        {
             $build .= $this->translateLimit();
        }

        return $build;
    }
104927
public function setTranslatable(TranslatableInterface $translatable = null)
    {
        if ($translatable === $this->translatable) {
            return $this;
        }

        $previousTranslatable = $this->translatable;
        $this->translatable = $translatable;

        /** @var TranslationInterface $this */
        if (null !== $previousTranslatable) {
            $previousTranslatable->removeTranslation($this);
        }

        if (null !== $translatable) {
            $translatable->addTranslation($this);
        }

        return $this;
    }