8000 [TwigBundle] register an identity translator as fallback by xabbuh · Pull Request #24358 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[TwigBundle] register an identity translator as fallback #24358

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
Sep 28, 2017

Conversation

xabbuh
Copy link
Member
@xabbuh xabbuh commented Sep 28, 2017
Q A
Branch? 3.4
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #24303 (comment)
License MIT
Doc PR

The Form component can be used without the Translation component.
However, to be able to use the default form themes provided by the
TwigBridge you need to have the trans filter to be available.

This change ensures that there will always be a trans filter which as
a fallback will just return the message key if no translator is present.

The Form component can be used without the Translation component.
However, to be able to use the default form themes provided by the
TwigBridge you need to have the `trans` filter to be available.

This change ensure that there will always be a `trans` filter which as
a fallback will just return the message key if no translator is present.
@xabbuh
Copy link
Member Author
xabbuh commented Sep 28, 2017

#24303 already improved the situation when running composer require/composer install. Though I suggest we can go one step further and also make the core form themes available even if the user does not want to use the Translation component.

Copy link
Member
@fabpot fabpot left a comment

Choose a reason for hiding this comment

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

Excellent as so simple!

Copy link
Member
@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

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

Really nice! Thanks.

@fabpot
Copy link
Member
fabpot commented Sep 28, 2017

Thank you @xabbuh.

@fabpot fabpot merged commit f0876e5 into symfony:3.4 Sep 28, 2017
fabpot added a commit that referenced this pull request Sep 28, 2017
…ck (xabbuh)

This PR was merged into the 3.4 branch.

Discussion
----------

[TwigBundle] register an identity translator as fallback

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #24303 (comment)
| License       | MIT
| Doc PR        |

The Form component can be used without the Translation component.
However, to be able to use the default form themes provided by the
TwigBridge you need to have the `trans` filter to be available.

This change ensure that there will always be a `trans` filter which as
a fallback will just return the message key if no translator is present.

Commits
-------

f0876e5 register an identity translator as fallback
@xabbuh xabbuh deleted the twig-identity-translator branch September 28, 2017 13:30
@@ -94,11 +94,19 @@ public function getTranslationNodeVisitor()

public function trans($message, array $arguments = array(), $domain = null, $locale = null)
{
if (null === $this->translator) {
return $message;
Copy link
Member

Choose a reason for hiding this comment

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

we should still replace arguments IMO. Otherwise this does not work even for the case where the English message is the source

fabpot added a commit that referenced this pull request Oct 12, 2017
…or (xabbuh)

This PR was merged into the 3.4 branch.

Discussion
----------

[TwigBridge] replace parameters in dummy identity translator

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #24358 (comment)
| License       | MIT
| Doc PR        |

Commits
-------

2c9c3d8 replace parameters in dummy identity translator
This was referenced Oct 18, 2017
fabpot added a commit that referenced this pull request Nov 7, 2017
This PR was merged into the 3.4 branch.

Discussion
----------

[Bridge\Twig] Lazy-load deps

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Spotted while benching a HelloWorld and comparing v3.3 to v4.0.
At this micro-bench level, even registering one more twig extension makes a difference (here, it's `TranslationExtension`, after #24358)

Commits
-------

3fc766f [Bridge\Twig] Lazy-load deps
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull request Sep 21, 2018
…allback (yceruto)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[FrameworkBundle] Register an identity translator as fallback

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #27589
| License       | MIT
| Doc PR        | -

The same approach as symfony/symfony#24358, suggested by @xabbuh here symfony/symfony#27589 (comment)

**Templating Engine Context**

The Form component can be used without the Translation component.
However, to be able to use the default form themes provided by the
`FrameworkBundle` you need to have the `translator` helper to be available.

This change ensure that there will always be a `translator` helper which
as a fallback will just return the message key if no translator is present.

Commits
-------

5330f2d017 [FrameworkBundle] Register an identity translator as fallback
nicolas-grekas added a commit that referenced this pull request Sep 21, 2018
…allback (yceruto)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[FrameworkBundle] Register an identity translator as fallback

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #27589
| License       | MIT
| Doc PR        | -

The same approach as #24358, suggested by @xabbuh here #27589 (comment)

**Templating Engine Context**

The Form component can be used without the Translation component.
However, to be able to use the default form themes provided by the
`FrameworkBundle` you need to have the `translator` helper to be available.

This change ensure that there will always be a `translator` helper which
as a fallback will just return the message key if no translator is present.

Commits
-------

5330f2d [FrameworkBundle] Register an identity translator as fallback
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.

6 participants
0