We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I18nRoutingBundle doesn't seem to be working for Symfony 3.4.
JobController.php
use BeSimple\I18nRoutingBundle\Routing\Annotation\I18nRoute; class JobController extends Controller { /** * * @I18nRoute({ "en": "/jobs", "pl": "/ogloszenia" }, name="jobs") * @Method("GET") */ public function jobsListAction() { $jobs = $this->getDoctrine() ->getRepository(Job::class) ->findAllActive(); return $this->render('job/list.html.twig', [ 'jobs' => $jobs, ]); } }
config.yml
be_simple_i18n_routing: annotations: true
error:
An exception has been thrown during the rendering of a template ("I18nRoute "jobs" (pl) does not exist.").
The text was updated successfully, but these errors were encountered:
Ok, to fix the problem new BeSimple\I18nRoutingBundle\BeSimpleI18nRoutingBundle() needs to be placed at the beginning of bundles list in AppKernel.php
new BeSimple\I18nRoutingBundle\BeSimpleI18nRoutingBundle()
AppKernel.php
Its actually half fixed. I realised that standard annotation@Route() doesn't work.
@Route()
Anyone?
Sorry, something went wrong.
It works for me on multiple project with these, like yours: (But i forked this project to update some things :))
parameters: locales: [hu, en, de] # change them to [en, pl] # ... be_simple_i18n_routing: annotations: true
controlelr:
use BeSimple\I18nRoutingBundle\Routing\Annotation\I18nRoute; class DefaultController extends Controller { /** * @I18nRoute({"hu": "/fooldal/", "en": "/homepage/", "de": "/startseite/"}, name="homepage") */ public function indexAction(Request $request) { // ...
Use method restrictions in route declaration, like this: @I18nRoute({ "en": "/jobs", "pl": "/ogloszenia" }, name="jobs", methods={"GET"})
@I18nRoute({ "en": "/jobs", "pl": "/ogloszenia" }, name="jobs", methods={"GET"})
So probably you missed the locales in parameter section, but you can try add these line to config.yml:
parameters: locale: en framework: translator: { fallbacks: ['%locale%'] }
Or try in routing.yml:
routing.yml
app: resource: '@AppBundle/Controller/' type: annotation
No branches or pull requests
I18nRoutingBundle doesn't seem to be working for Symfony 3.4.
JobController.php
config.yml
error:
The text was updated successfully, but these errors were encountered: