lexik / LexikTranslationBundle

This Symfony bundle allow to import translation files content into the database and provide a GUI to edit translations.
MIT License
419 stars 255 forks source link

Impossible to configure managed_locales using ENV #420

Open raziel057 opened 2 years ago

raziel057 commented 2 years ago

Hello,

I was trying to make the configuration of manage_locales configurable by ENV but it's not working as the resolution of env vars is not done at compile time. See https://github.com/symfony/symfony/issues/33358

So in this case if I configure:

parameters:
    env(ACTIVE_LANGUAGES): '["fr, en"]'

lexik_translation:
    managed_locales: '%env(json:ACTIVE_LANGUAGES)%'

I got the following error in LexikTranslationExtension: Fatal error: Uncaught TypeError: sort(): Argument #1 ($array) must be of type array, string given in X:\workspace-novento\novento-vip-lounge\vendor\lexik\translation-bundle\DependencyInjection\LexikTranslationExtension.php:45 Stack trace: #0 X:\workspace-novento\novento-vip-lounge\vendor\lexik\translation-bundle\DependencyInjection\LexikTranslationExtension.php(45): sort('env_60da4350975...')

Because managed_locales is env_60da435097537916_json_resolve_ACTIVE_LANGUAGES_8287d553308fc5cd29...

raziel057 commented 1 year ago

This issue is related to https://github.com/symfony/symfony/issues/40794