Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

[Translator] Make sure a null locale is handled properly#38127

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:4.4fromjschaedl:translation-issue-38124
Sep 18, 2020

Conversation

@jschaedl
Copy link
Contributor

@jschaedljschaedl commentedSep 9, 2020
edited by xabbuh
Loading

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix#38124
LicenseMIT
Doc PR-

@fabpot
Copy link
Member

Tests seems broken by this change.

@ro0NL
Copy link
Contributor

@jschaedl we need to ensure a fixed default locale still, see e.g.7fce86f#diff-59203b25094d9f89c0a4abd9864d8a9c

@jschaedl
Copy link
ContributorAuthor

@ro0NL Thanks for the hint :-)

@jschaedljschaedlforce-pushed thetranslation-issue-38124 branch 2 times, most recently from53e2d66 to1fb1f46CompareSeptember 16, 2020 16:10
publicfunctiongetLocale()
{
return$this->locale;
return$this->locale ?: \Locale::getDefault();
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Borrowed fromhttps://github.com/symfony/contracts/blob/master/Translation/TranslatorTrait.php#L38 which implies that an empty locale is not a valid locale.

Copy link
Contributor

Choose a reason for hiding this comment

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

if we want to take this route, i would preserve the empty string (as given by the user)

and validate as such in assertValidLocale, rather than silently ignoring it.

I think it's worth a discussion on master.

jschaedl reacted with thumbs up emoji
Copy link
ContributorAuthor

@jschaedljschaedlSep 16, 2020
edited
Loading

Choose a reason for hiding this comment

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

I think we could do this:
For now we deprecate the possibility to set en empty locale in 4.4 and stick with$this->locale ?? \Locale::getDefault(); for now and afterwards we add a proper validation inassertValidLocale on master.

WDYT?

Copy link
Contributor

@ro0NLro0NLSep 16, 2020
edited
Loading

Choose a reason for hiding this comment

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

we cannot add new deprecations in a patch release either :)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

ah true 🙈

publicfunctiongetValidLocalesTests()
{
return [
[''],
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure we should change this behavior in a patch release :/
the previous?? \Locale::getDefault() approach was fine no?

Copy link
ContributorAuthor

@jschaedljschaedlSep 16, 2020
edited
Loading

Choose a reason for hiding this comment

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

Actually I am not sure too, but good point.

I thought it would be good to have bothTranslator andTranslatorTrait work the same way.

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought it would be good have both Translator and TranslatorTrait work the same way.

i think that's worth pursuing yes ... on master, then we wait for@nicolas-grekas's review also :)

jschaedl reacted with thumbs up emoji
@jschaedl
Copy link
ContributorAuthor

@ro0NL I reverted things as discussed.

@fabpotfabpotforce-pushed thetranslation-issue-38124 branch fromac9bd5e to080ea5aCompareSeptember 18, 2020 08:46
@fabpot
Copy link
Member

Thank you@jschaedl.

jschaedl reacted with hooray emoji

@fabpotfabpot merged commit785a066 intosymfony:4.4Sep 18, 2020
@Aliance
Copy link
Contributor

@fabpot are you planning to release a new version with this fix?

@jschaedl
Copy link
ContributorAuthor

@Aliance A new patch version comes out at the end of every month.
See:https://symfony.com/doc/current/contributing/community/releases.html

A new Symfony patch version (e.g. 4.4.9, 5.0.9, 5.1.1) comes out roughly every month. It only contains bug fixes, so you can safely upgrade your applications;

You can subscribe for release notifications on this site:https://symfony.com/account/notifications

Aliance reacted with thumbs up emoji

This was referencedSep 27, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@fabpotfabpotfabpot approved these changes

@xabbuhxabbuhxabbuh approved these changes

+1 more reviewer

@ro0NLro0NLro0NL approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

7 participants

@jschaedl@fabpot@ro0NL@Aliance@nicolas-grekas@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp