schmittjoh / JMSTranslationBundle

Puts the Symfony2 Translation Component on steroids
http://jmsyst.com/bundles/JMSTranslationBundle
426 stars 292 forks source link

Symfony 4 : Unable to find template "JMSTranslationBundle::base.html.twig" #503

Closed tilimac closed 5 years ago

tilimac commented 5 years ago
Q A
Bundle version 1.4.3
Symfony version 4.1.7
PHP version 7.2.8

Expected behavior

Loading UI display for translation

Actual behavior

On my local, i've this error : Unable to find template "JMSTranslationBundle::base.html.twig" (looked into: F:\www\evalandgo\site/templates) in @JMSTranslation\Translate\index.html.twig at line 1.

Steps to reproduce

I go on this URL site.com/_trans. My config :

jms_translation:
  locales: ['fr','en','es','pt','it','de']
  source_language: 'en'
  configs:
    app:
      dirs: ["%kernel.root_dir%/../templates", "%kernel.root_dir%/../src"]
      output_dir: "%kernel.project_dir%/translations"
      excluded_names: ["*TestCase.php", "*Test.php"]
      excluded_dirs: [cache, data, logs]

In my routes files, i add :

JMSTranslationBundle_ui:
    resource: "@JMSTranslationBundle/Controller/"
    prefix:   /_trans

And i add this in my services.yaml


services:
    [...]

    JMS\TranslationBundle\Controller\TranslateController:
        public: true
        arguments:
            $configFactory: '@jms_translation.config_factory'
            $loader: '@jms_translation.loader_manager'

    JMS\TranslationBundle\Controller\ApiController:
        public: true
        arguments:
            $configFactory: '@jms_translation.config_factory'
            $updater: '@jms_translation.updater'

Someone has a solution ?

goetas commented 5 years ago

fixed in https://github.com/schmittjoh/JMSTranslationBundle/pull/504

muhiddingithub commented 1 year ago

Must update layout path to "@JMSTranslationBundle/base.html.twig" If your symfony version greater than 6