protected function findTemplate($name)
    {
        if (!$this->isLoadableTemplate($name)) {
            throw new \Twig_Error_Loader(sprintf('Malformed namespaced template name "%s" (expecting "%stemplate_name").', $name, $this->prefix));
        }

        $templateIdentifier = substr($name, strlen($this->prefix));
        $template = $this->repository->find($templateIdentifier);
        if ($template === null) {
            throw new \Twig_Error_Loader(sprintf('Unable to find template "%s".', $name));
        }
        if (!($template instanceof TemplateInterface)) {
            throw new \Twig_Error_Loader(sprintf('Unexpected template type "%s" found for template "%s".', get_class($template), $name));
        }
        if ($template instanceof TranslatableTemplateInterface) {
            /** @var TranslatableTemplateInterface $template */
            $locale = $this->getCurrentLocale();
            $template->setCurrentLocale($locale);
        }

        return $template;
    }