Skip to content

[Translation] trans, add support of domain in $id message #37769

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

Closed
wants to merge 5 commits into from

Conversation

wtorsi
Copy link

@wtorsi wtorsi commented Aug 8, 2020

Q A
Branch? master for features
Bug fix? no
New feature? yes
Deprecations? no
Tickets #37743
License MIT
Doc PR

Add support of domain in id message while translating

@wtorsi wtorsi changed the title [ISSUE_37743] trans, add support of domain in $id message [Translation] trans, add support of domain in $id message Aug 8, 2020
@xabbuh xabbuh added this to the next milestone Aug 8, 2020
Copy link
Contributor

@YaFou YaFou left a comment

Choose a reason for hiding this comment

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

👍 Can you add a test for this feature?

@wtorsi
Copy link
Author

wtorsi commented Aug 8, 2020

@YaFou sure, done

Copy link
Contributor

@YaFou YaFou left a comment

Choose a reason for hiding this comment

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

Good job @wtorsi! And great feature!

@xabbuh
Copy link
Member

xabbuh commented Aug 8, 2020

This looks like a BC break to me as it will break most existing translations that contain the @ character. The only viable BC solution that I see would be to create a decorator which contains this logic and that would be an opt-in feature.

@YaFou
Copy link
Contributor

YaFou commented Aug 8, 2020

This looks like a BC break to me as it will break most existing translations that contain the @ character. The only viable BC solution that I see would be to create a decorator which contains this logic and that would be an opt-in feature.

Good point. A solution may be to add an argument to the Translator class which controls this option. Also this feature can be applied in version 6 generally which will be a breaking change.

@wtorsi
Copy link
Author

wtorsi commented Aug 8, 2020

Just found that DataCollectorTranslator will be broken after this pull request.
I think It's a good idea, but it needs a little bit more work and considerations

@ro0NL
Copy link
Contributor

ro0NL commented Aug 9, 2020

Shouldnt we prefer the approach in #37670?

@wtorsi
Copy link
Author

wtorsi commented Aug 9, 2020

I prefer the approach of translatable objects in #37670 , but my idea is to encode domain in message ID itself, because in my opinion it is easier to store such ids in database

@fabpot
Copy link
Member

fabpot commented Aug 11, 2020

I'm against this change. First, it's a BC break, then, it looks a bit hacky, it's also yet another way to do something we can already do, and last, it does not work well when you are not using translation strings: $this->translator->trans('This is a message to translate@messages', $params).

Thanks for proposing.

@fabpot fabpot closed this Aug 11, 2020
@nicolas-grekas nicolas-grekas modified the milestones: next, 5.2 Oct 5, 2020
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