Skip to content

Fatal error: translations in templates without installed translator #31754

@MMagicM

Description

@MMagicM

Symfony version(s) affected: 4.3.0

Description
Using trans filters in twig templates without the translator installed results in a fatal error instead of just displaying the string to translate (as was the case in every other version I used before).

How to reproduce
Do the following:

  1. composer create-project symfony/skeleton
  2. composer require symfony/twig-bundle
  3. composer require annotations
  4. Make a controller that renders the base.html.twig
  5. In the base.html.twig insert {{ 'test'|trans }}

Additional context
Stack Trace:
[Thu May 30 23:11:55.906614 2019] [php7:error] [pid 24356:tid 2000] [client ::1:53977] PHP Fatal error: Trait 'Symfony\Contracts\Translation\TranslatorTrait' not found in C:\xampp\htdocs\project2\vendor\symfony\twig-bridge\Extension\TranslationExtension.php on line 113
2019-05-30T23:11:55+02:00 [critical] Fatal Error: Trait 'Symfony\Contracts\Translation\TranslatorTrait' not found
2019-05-30T23:11:56+02:00 [critical] Uncaught PHP Exception Symfony\Component\Debug\Exception\ClassNotFoundException: "Attempted to load trait "TranslatorTrait" from namespace "Symfony\Contracts\Translation".
Did you forget a "use" statement for another namespace?" at C:\xampp\htdocs\project2\vendor\symfony\twig-bridge\Extension\TranslationExtension.php line 113

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy