Reputation: 71
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?
Upvotes: 5
Views: 453
Reputation: 94
<div class="row">
{{ pagerfanta(pager, 'twitter_bootstrap4', { prev_message: 'Vorherige', next_message: 'Nächste'}) }}
</div>
in some cases you may directly inject your translation
Upvotes: 1
Reputation: 226
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.
Upvotes: 4