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?
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.
Related
I work with Symfony 4.2
I divided my dir structure, and every part of app is in other folder.
Ex. admin part code is in src/Admin/...
- src/Admin/Controller
etc.
When I set #Template in controller method symfony tell me to situate templates in templates/
But I want to it placed in teplates/Admin/
What I should change in config.
If is other solution than set every action path in #Template(...) ?
Taken from the docs:
# config/packages/twig.yaml
twig:
# ...
paths: ["%kernel.project_dir%/resources/views"]
https://symfony.com/doc/current/configuration/override_dir_structure.html#override-the-templates-directory
This might also be interesting for you:
https://symfony.com/doc/current/templating/namespaced_paths.html#multiple-paths-per-namespace
Hello I´m doing upload of images with vich upload and is returning the path name as.
The images were being uploaded and being displayed in the easy admin.
But then suddenly it started to not load the images anymore, and I´ve found that the destination directory was changed to ->
C:\xampp_\tmp\phpB51C.tmp
my vich mapping is like
mappings:
manchete_images:
uri_prefix: '\uploads\images\manchetes'
upload_destination: '%kernel.project_dir%/public/uploads/images/manchetes'
the images were appering normally, then suddenly start to broken to and is not creating the file upload file in the public directory
Try changing the \ in uri_prefix: '\uploads\images\manchetes' for / and try again.
Firstable as Ez mentionned you need to change the \ in uri_prefix.
Second, ther's a problem in your easy_admin configuration with the edit form.
you need to use caminhoDaImagem proprety instead of arquivoDaImagem under your form, new or edit configuration...and the file type should be changed from file to vich_file or vixh_image. ..It's already mentioned in the doc https://symfony.com/doc/master/bundles/EasyAdminBundle/integration/vichuploaderbundle.html#uploading-the-images-in-the-edit-and-new-views
easy_admin:
entities:
Product:
# ...
form:
fields:
- { property: 'imageFile', type: 'vich_image' }
I fixed your code you can see my PR
I read the Bundle documentation, but I can't find how to change these labels:
So, I found how to change the list.page_title, but I can't find about point 1, 2, 4, 5 on the image. Also, I can't find how to remove the ID column (field) from any list view. I follow the tutorial, but when he install Easy Admin Bundle action.search was Search for him, action.new was New etc...
I tried with:
list:
fields:
- '-id'
You have to enable symfony translation module in your config.yml:
framework:
translator: { fallbacks: ['%locale%'] }
I need to switch 'translation fallback' and 'persistDefaultLocaleTranslation' on.
I know how to change it: https://github.com/l3pp4rd/DoctrineExtensions/blob/master/doc/translatable.md#default-locale
but don't know where should I access that listener.. Maybe in config.yml? how??
I am looking for something like this:
(config.yml)
...
translatable-extension:
translationFallback:true
persistDefaultLocaleTranslation: true
If you have the StofDoctrineExtensionsBundle installed (https://github.com/stof/StofDoctrineExtensionsBundle), you can configure the default values for this in config.yml
stof_doctrine_extensions:
default_locale: "%locale%"
translation_fallback: true
persist_default_translation: true
Haven't found this is in any docs, but it is in the configuration for the bundle https://github.com/stof/StofDoctrineExtensionsBundle/blob/master/DependencyInjection/Configuration.php#L30
I'm not sure I fully understand what you are asking but in a typical setup you would have the translation fallback referenced in your config.yml like this.
framework:
translator: { fallback: %locale% }
In this example the locale placeholder references the locale setting in your parameters.ini/parameters.yml file.
I believe this is commented out by default in your config.yml but uncommenting this line will effectively enable translations.
You can see the full list of configuration options with along with their defaults here:
http://symfony.com/doc/current/reference/configuration/framework.html#full-default-configuration
When i am trying to persist content through my entity i get the following error:
Class Gedmo\Translatable\Entity\Translation is not a valid entity or mapped super class.
I have done some research, but can't find anything that solves this problem.
The error disappears when I change:
orm:
default: translatable: true
To:
orm: default: ~
in config.yml.
But the content is not saved as translation, but overwrites the existing content in the "new" language.
I have the following relevant lines in my deps file:
[symfony]
git=http://github.com/symfony/symfony.git
version=origin/2.0
[gedmo-doctrine-extensions]
git=http://github.com/l3pp4rd/DoctrineExtensions.git
version=v2.3.0
[Stof-DoctrineExtensionsBundle]
git=https://github.com/stof/StofDoctrineExtensionsBundle.git
target=/bundles/Stof/DoctrineExtensionsBundle
I think that the problem is that you are requesting version 2.3.0 of the extensions but your symfony version is 2.0.x which does not include the latest Doctrine version. You should change this to:
[gedmo-doctrine-extensions]
git=http://github.com/l3pp4rd/DoctrineExtensions.git
version=v2.1.0
[DoctrineExtensionsBundle]
git=http://github.com/stof/StofDoctrineExtensionsBundle.git
target=/bundles/Stof/DoctrineExtensionsBundle
version=1.0.0