Synfony – how to replace services.yaml with services.php to generate dynamically app_locales

  php, service, symfony

my application is multilinguage and i can enable/disable language into bdd table from backoffice, but with app_locales declaration array from services.yaml, i can’t dynamically add or remove lang. so first i want to replace services.yaml with services.php to declare app_locales as :

namespace SymfonyComponentDependencyInjectionLoaderConfigurator;

use AppSecurityCustomInterface;
use PsrLogLoggerInterface;
use SymfonyComponentDependencyInjectionDefinition;
use SymfonyComponentDependencyInjectionReference;

return static function (ContainerConfigurator $container) {
    $parameters = $container->parameters()
            ->set('locale', 'fr')
            ->set('app_locales', ['ar', 'en', 'es', 'fr', 'it', 'tr'])
            ->set('user_translations', '%kernel.project_dir%/public/uploads/user_translations');

but i use annotation to declare routes as :@Route("/{_locale<%app_locales%>}/back")

and i have this error: You have requested a non-existent parameter "app_locales"

is there anyboby who knows how to do?

because i think that when i will declare array in services.php, i could load array from lang controller

Source: Ask PHP