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
Related
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.
Is it possible to set the default value for enableMaxDepthChecks to true?
Currently I have to add the following annotation to every route:
#View(serializerEnableMaxDepthChecks=true)
Is there a way to set this in the config or elsewhere to be the default?
Place this into your config.yml
jms_serializer:
default_context:
serialization:
enable_max_depth_checks: true
BUT! After making these changes, the parameter serializerEnableMaxDepthChecks becomes non-working, so you can't set it to false , and I don't know why...
By default, ApiDoc lists out all operations for each API endpoint, like this:
In the Swagger demo, however, operations are hidden by default until the user chooses to show them.
Is there a configuration option for ApiDoc that will hide operations by default? I haven't found anything like this in the documentation.
Documentation section can be hidden by default with parameter default_sections_opened:
nelmio_api_doc.default_sections_opened: false
Default value for this parameter is true. See configuration reference.
You must change your config.yml file like this (default_sections_opened to false):
nelmio_api_doc:
name: 'API documentation'
exclude_sections: []
**default_sections_opened: false**
motd:
template: 'NelmioApiDocBundle::Components/motd.html.twig'
request_listener:
enabled: true
parameter: _doc
sandbox:
enabled: false
In my Sf2 parameters.yml file I've got something like this:
router.request_context.base_url: "asddassda"
website_url: "123%router.request_context.base_url%"
But when I print website_url somewhere, it only shows "123". Other variables like router.request_context.host and router.request_context.scheme are NOT visible as well. Why and how can I fix this?
I got the same problem.
Somehow parameters that name starts as router. are not visable in config.yml. Maybe it's a bug. If I get it by ParametersBag it works fine.
As a workaround I chenge name to routerX. and it works:
# app/config/parameters.ini
parameters:
routerX.request_context.base_url: "asddassda"
website_url: "123%routerX.request_context.base_url%"
And
# app/config/config.yml
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
globals:
website_url: "%website_url%"
And then in twig template
{{ website_url }}
Tried. It's working for me.
Are you sure you didn't overwrite this parameter router.request_context.base_url somewhere else in your 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