Search code examples
phpsymfonyfosoauthserverbundle

FOSOAuthServerBundle translate error messages


I installed FOSOAuthServerBundle and everything went well, but I don't know how to translate error messages like this:

{"error":"invalid_request","error_description":"Invalid grant_type parameter or parameter missing"}

I want to provide translation for error messages in languages other than English (e.g. French). Any solution?


Solution

  • a friend tell me that he resolved it with extending OAuth2/OAuth2 class and overriding methods. You can override the default package class OAuth2 in services.yml:

    parameters:
        fos_oauth_server.server.class: My\Bundle\OAuth2\OAuth2
    

    it may be a solution but it should be an other solution with configuration