Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bin/console lint:container - Invalid definition for service "console.command.translation_lint" with "pseudo_localization" #59101

Copy link
Copy link
Closed
@SindlaXYZ

Description

@SindlaXYZ
Issue body actions

Symfony version(s) affected

7.2.0

Description

I just updated my Symfony project from Symfony 7.1 to 7.2.0.
Now, when I run the command bin/console lint:container, I get this error:

[ERROR] Invalid definition for service "console.command.translation_lint": argument 1 of "Symfony\Component\Translation\Command\TranslationLintCommand::__construct()" accepts "Symfony\Contracts\Translation\TranslatorInterface&Symfony\Component\Translation\TranslatorBagInterface", "Symfony\Component\Translation\PseudoLocalizationTranslator" passed.

I tried using the --resolve-env-vars parameter: same error.
I also receive the same error in both the dev and production environments.

This is my translation.yaml file:

# config/packages/translation.yaml
framework:
    default_locale: '%locale%' # Read from parameters.locale
    enabled_locales: '%locales%' # Read from parameters.locales
    translator:
        default_path: '%kernel.project_dir%/translations'
        # This option is used when the translation key for the current locale wasn't found | default: the value of default_locale
        fallbacks:
            - '%locale%'
        providers:
        pseudo_localization:
            # replace characters by their accented version
            accents: false
            # wrap strings with brackets
            brackets: false
            # controls how many extra characters are added to make text longer
            expansion_factor: 1
            # maintain the original HTML tags of the translated contents
            parse_html: true
            # also translate the contents of these HTML attributes
            #localizable_html_attributes: ['title']

when@prod:
    framework:
        translator:
            pseudo_localization:
                accents: false
                brackets: false

If I comment out the pseudo_localization: block, the error goes away.

I encountered the same error with the translation.yaml example from https://symfony.com/doc/current/translation.html.

# config/packages/translation.yaml
framework:
    translator:
        pseudo_localization:
            # replace characters by their accented version
            accents: true
            # wrap strings with brackets
            brackets: true
            # controls how many extra characters are added to make text longer
            expansion_factor: 1.4
            # maintain the original HTML tags of the translated contents
            parse_html: true
            # also translate the contents of these HTML attributes
            localizable_html_attributes: ['title']

How to reproduce

Run the command bin/console lint:container with:

# config/packages/translation.yaml
framework:
    translator:
        pseudo_localization:
            # replace characters by their accented version
            accents: true
            # wrap strings with brackets
            brackets: true
            # controls how many extra characters are added to make text longer
            expansion_factor: 1.4
            # maintain the original HTML tags of the translated contents
            parse_html: true
            # also translate the contents of these HTML attributes
            localizable_html_attributes: ['title']

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.