symfonytranslationpagerfanta

Symfony pagerfanta - can't translate the text in final pagination


I'm trying to translate from english the next and previous in pagination.
I've tried creating normal pagerfanta.cs.yaml with Previous: "Předchozí" Next: "Následující" and pagerfanta even has its own translations so it should work by itself, but copying the original pagerfanta.cs.xliff to the translations folder doesn't work either.
In services.yaml I have:

parameters: 
    locale: 'en'

and in translation.yaml:

 framework:
    default_locale: cs
    translator:
        default_path: '%kernel.project_dir%/translations'
        fallbacks:
            - '%locale%'

Symfony debug toolbar also doesn't even catch any translations should take place.
Any ideas why it's not working?


Solution

  • You should install pagerfanta/twig package in order to use translatable templates. Then create a new config file at config/packages/babdev_pagerfanta.yaml containing

    babdev_pagerfanta:
        default_view: twig
        default_twig_template: '@BabDevPagerfanta/twitter_bootstrap5.html.twig'
    

    By selecting twig as default_view, the translations are going to be handled properly.