0

I installed the twig/extensions by typing:

composer require twig/extensions

I then added it as a service in the services.yaml file as follows:

twig.extension.intl:
  class: Twig_Extensions_Extension_Intl
  tags:
      - { name: twig.extension }

My Twig code is:

{{ request.createdAt |  localizeddate('full', 'none', 'fr' ) }}

But I'm getting this error:

Attempted to load class "IntlTimeZone" from the global namespace. Did you forget a "use" statement?

Any hints ?

  • do you have PHP intl ext installed? php.net/manual/en/book.intl.php – kallosz Aug 01 '18 at 12:03
  • 1
    Have a look at [How to install the Intl extension for Twig](https://stackoverflow.com/questions/25948853/how-to-install-the-intl-extension-for-twig). Your question seems to be a duplicate of that one. – Nima Aug 01 '18 at 12:05
  • @kallosz It worked!!! Great comment from a good guy , thank you very much!!! – J. NC. Maestro Aug 01 '18 at 12:09
  • @Nima I already installed it ! Anyway , thank you for the comment! – J. NC. Maestro Aug 01 '18 at 12:10
  • @kallosz Sorry it didn't appear in my search results – J. NC. Maestro Aug 01 '18 at 12:18
  • I linked to that question because the accepted answer explicitly mentions you have to install intl extension for php (as kallosz suggested here). Also, [The Intl Extension](http://twig-extensions.readthedocs.io/en/latest/intl.html) mentions that. You probably missed it. – Nima Aug 01 '18 at 12:36

0 Answers0