Skip to content

Translations: enable pseudo-localization conditionally #60093

Answered by MatTheCat
kAlvaro asked this question in Q&A
Discussion options

You must be logged in to vote

Yes: pseudo_localization can be enabled by configuring any of its options like you did, but it also has an enabled option you can set to false to disable it. So you could write something like

# config/packages/translation.yaml
framework:
    translator:
        pseudo_localization:
            enabled: '%localization.pseudo_localization_enabled%'
            expansion_factor: 1.4
            parse_html: true
            localizable_html_attributes: ['title']

Note that if enabling the pseudo-localization only depends on the environment you should leverage Symfony’s way: https://symfony.com/doc/current/configuration.html#configuration-environments

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kAlvaro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants