-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Contracts] move Translatable to symfony/translation-contracts #38328
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
[Contracts] move Translatable to symfony/translation-contracts #38328
Conversation
2b627dc
to
c633dee
Compare
c633dee
to
efdedfc
Compare
/cc @natewiebe13 FYI |
efdedfc
to
4e9404d
Compare
FYI, I just moved the |
4e9404d
to
56f470a
Compare
56f470a
to
313a702
Compare
313a702
to
e0e5751
Compare
This PR was merged into the 5.2-dev branch. Discussion ---------- [lock] Fix non-blocking store fallback | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | / | License | MIT | Doc PR | / Fix issue introduced in #38328 Tests added to avoid regressions. Commits ------- 7a80e41 Fix non-blocking store fallback
See alternative proposal in #38330. |
@nicolas-grekas maybe a separate PR could be created (and merged) with all the common changes (nullable domain, namespaced On a side note, merging any of these PRs will require updating the blog post as it changes the API. |
Closing in favor of #38330 since that's where the consensus seems to go. |
This PR was merged into the 5.2-dev branch. Discussion ---------- [Contracts] add TranslatableInterface | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | #38319 | License | MIT | Doc PR | - An alternative to #38328: - `TranslatableInterface` is added to symfony/contracts; - `Translatable`, still in the component, implements it (and is not final as it makes no sense for a value-object) - the `t()` function is kept in the component - it doesn't fit in the contracts IMHO; - `Translatable::trans()` is not static anymore; - the domain is nullable instead of defaulting to "messages"; - the `t()` function moved in the `Symfony\Component\Translation` namespace (for reference, the `s()` function from String is also namespaced.); - the Twig extension is made strictly polymorphic: if you pass a Translatable, you cannot pass arguments/domain/count. Commits ------- 9224f7a [Contracts] add TranslatableInterface
As discussed in the RFC:
Translatable
is moved to symfony/contracts;Translatable
is not final anymore, it makes no sense for a value-object, especially in contracts;t()
function is kept in the component - it doesn't fit in the contracts IMHO;Translatable::trans()
is not static anymore;t()
function moved in theSymfony\Component\Translation
namespace (for reference, thes()
function from String is also namespaced.)