Skip to content

[FrameworkBundle] Use default_locale as default value for translator.fallbacks #32106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 5, 2019

Conversation

dunglas
Copy link
Member

@dunglas dunglas commented Jun 19, 2019

Q A
Branch? 4.4
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR n/a

Simplify translator's config:

Before:

    default_locale: fr
    translator:
        default_path: '%kernel.project_dir%/translations'
        fallbacks:
            - fr

After:

    default_locale: fr
    translator:
        default_path: '%kernel.project_dir%/translations'

->beforeNormalization()->ifString()->then(function ($v) { return [$v]; })->end()
->prototype('scalar')->end()
->defaultValue(['en'])
->defaultValue([])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a BC break?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not if default_local was set to the same value, right? Should always be the case?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. For a German site I would set default_locale to de but keep the fallback set to en if my team writes English messages and translations are provided later by a separate team.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an edge case that can be fixed very easily, and deserves to be explicit IMHO. The current behavior create a WTF situation where you change the default_locale, but it's not taken into account by Symfony itself without having to change another setting.

@nicolas-grekas nicolas-grekas added this to the next milestone Jun 23, 2019
@fabpot
Copy link
Member

fabpot commented Jul 5, 2019

Thank you @dunglas.

@fabpot fabpot merged commit e0ef359 into symfony:4.4 Jul 5, 2019
fabpot added a commit that referenced this pull request Jul 5, 2019
…for translator.fallbacks (dunglas)

This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle] Use default_locale as default value for translator.fallbacks

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Simplify translator's config:

Before:

```yaml
    default_locale: fr
    translator:
        default_path: '%kernel.project_dir%/translations'
        fallbacks:
            - fr
```

After:

```yaml
    default_locale: fr
    translator:
        default_path: '%kernel.project_dir%/translations'
```

Commits
-------

e0ef359 [FrameworkBundle] Use default_locale as default value for translator.fallbacks
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.4 Oct 27, 2019
This was referenced Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants