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

[Twig] Addapp.locale documentation#18190

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
OskarStark merged 1 commit intosymfony:6.3fromSVillette:twig-app-variable-locale
Apr 14, 2023
Merged

[Twig] Addapp.locale documentation#18190

OskarStark merged 1 commit intosymfony:6.3fromSVillette:twig-app-variable-locale
Apr 14, 2023

Conversation

@SVillette
Copy link
Contributor

The PR add documentation ofsymfony/symfony#49913

@carsonbotcarsonbot added this to the6.3 milestoneApr 11, 2023
@javiereguiluzjaviereguiluz added the Waiting Code MergeDocs for features pending to be merged labelApr 11, 2023
@carsonbotcarsonbot modified the milestones:6.3,nextApr 11, 2023
fabpot added a commit to symfony/symfony that referenced this pull requestApr 11, 2023
…iable` (SVillette)This PR was squashed before being merged into the 6.3 branch.Discussion----------[TwigBridge][TwigBundle] Add current locale to `AppVariable`| Q             | A| ------------- | ---| Branch?       | 6.3| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Tickets       |Fix#49870| License       | MIT| Doc PR        |symfony/symfony-docs#18190As stated in#49870, they were no way to get the current locale without passing it through a variable when rendering a template within `LocaleSwitcher::runWithLocale()`.```php#[AsController]final class HomeController{    #[Route('/', name: 'app_home')]    public function __invoke(LocaleSwitcher $localeSwitcher, Environment $twig): Response    {        $localeSwitcher->setLocale('en');        return $localeSwitcher->runWithLocale('fr', function () use ($twig) {            return new Response($twig->render('index.html.twig'));        });    }}``````twig{{ app.locale }} // fr```A doc PR will be submitted if this change is accepted.Commits-------2371216 [TwigBridge][TwigBundle] Add current locale to `AppVariable`
symfony-splitter pushed a commit to symfony/twig-bridge that referenced this pull requestApr 11, 2023
…iable` (SVillette)This PR was squashed before being merged into the 6.3 branch.Discussion----------[TwigBridge][TwigBundle] Add current locale to `AppVariable`| Q             | A| ------------- | ---| Branch?       | 6.3| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Tickets       | Fix #49870| License       | MIT| Doc PR        |symfony/symfony-docs#18190As stated in #49870, they were no way to get the current locale without passing it through a variable when rendering a template within `LocaleSwitcher::runWithLocale()`.```php#[AsController]final class HomeController{    #[Route('/', name: 'app_home')]    public function __invoke(LocaleSwitcher $localeSwitcher, Environment $twig): Response    {        $localeSwitcher->setLocale('en');        return $localeSwitcher->runWithLocale('fr', function () use ($twig) {            return new Response($twig->render('index.html.twig'));        });    }}``````twig{{ app.locale }} // fr```A doc PR will be submitted if this change is accepted.Commits-------2371216d93 [TwigBridge][TwigBundle] Add current locale to `AppVariable`
@SVilletteSVillette changed the title[WCM] Add Twigapp.locale documentationAdd Twigapp.locale documentationApr 11, 2023
@SVillette
Copy link
ContributorAuthor

Hi@OskarStark@javiereguiluz,

Just a friendly ping to inform you that the feature PR is merged now. I think the labelWaiting Code Merge can be removed now.

@OskarStarkOskarStark removed the Waiting Code MergeDocs for features pending to be merged labelApr 14, 2023
@OskarStarkOskarStark modified the milestones:next,6.3Apr 14, 2023
@carsonbotcarsonbot changed the titleAdd Twigapp.locale documentation[Twig] Add Twigapp.locale documentationApr 14, 2023
@OskarStarkOskarStark changed the title[Twig] Add Twigapp.locale documentation[Twig] Addapp.locale documentationApr 14, 2023
@OskarStark
Copy link
Contributor

Thanks Samaël for working on this feature, this is much appreciated.

SVillette reacted with heart emoji

@OskarStarkOskarStark merged commit70e861f intosymfony:6.3Apr 14, 2023
@SVilletteSVillette deleted the twig-app-variable-locale branchApril 14, 2023 08:28
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@OskarStarkOskarStarkOskarStark approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

6.3

Development

Successfully merging this pull request may close these issues.

4 participants

@SVillette@OskarStark@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp