2

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?

Matys333
  • 23
  • 5

2 Answers2

3

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.

TomKorec
  • 206
  • 2
  • 6
0
<div class="row">
  {{ pagerfanta(pager, 'twitter_bootstrap4', { prev_message: 'Vorherige', next_message: 'Nächste'}) }}
</div>

in some cases you may directly inject your translation

Sam Mumm
  • 84
  • 9