> Symfony 7 >

Course Overview

Login to bookmark this course

Bonjour-> Hello-> Hola: Translate your Site

Unleash the magic of Symfony's Translation component. Translate content, use localized routing, add a language switcher and connect to a translation provider!

  • intermediate
  • 140 students
  • EN/ES Captions
  • EN/ES Script
  • Certificate of Completion

Your Guides

About this course

What PHP libraries does this tutorial use?

// composer.json
{
    "require": {
        "php": ">=8.2",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "doctrine/dbal": "^3.9.4", // 3.9.4
        "doctrine/doctrine-bundle": "^2.14", // 2.14.0
        "doctrine/doctrine-migrations-bundle": "^3.4.2", // 3.4.2
        "doctrine/orm": "^3.3.3", // 3.3.3
        "league/commonmark": "^2.7", // 2.7.0
        "symfony/asset": "7.2.*", // v7.2.0
        "symfony/asset-mapper": "7.2.*", // v7.2.5
        "symfony/console": "7.2.*", // v7.2.6
        "symfony/crowdin-translation-provider": "7.2.*", // v7.2.0
        "symfony/dotenv": "7.2.*", // v7.2.0
        "symfony/flex": "^2.5.1", // v2.5.1
        "symfony/framework-bundle": "7.2.*", // v7.2.5
        "symfony/runtime": "7.2.*", // v7.2.3
        "symfony/stimulus-bundle": "^2.25", // v2.25.2
        "symfony/translation": "7.2.*", // v7.2.7
        "symfony/twig-bundle": "7.2.*", // v7.2.0
        "symfony/yaml": "7.2.*", // v7.2.6
        "symfonycasts/tailwind-bundle": "^0.10.0", // v0.10.0
        "twig/extra-bundle": "^2.12|^3.21", // v3.21.0
        "twig/markdown-extra": "^3.21", // v3.21.0
        "twig/string-extra": "^3.21", // v3.21.0
        "twig/twig": "^2.12|^3.21.1" // v3.21.1
    },
    "require-dev": {
        "doctrine/doctrine-fixtures-bundle": "^4.1", // 4.1.0
        "phpunit/phpunit": "^9.6.23", // 9.6.23
        "symfony/browser-kit": "7.2.*", // v7.2.4
        "symfony/css-selector": "7.2.*", // v7.2.0
        "symfony/debug-bundle": "7.2.*", // v7.2.0
        "symfony/maker-bundle": "^1.63", // v1.63.0
        "symfony/monolog-bundle": "^3.0", // v3.10.0
        "symfony/phpunit-bridge": "^7.2.6", // v7.2.6
        "symfony/stopwatch": "7.2.*", // v7.2.4
        "symfony/web-profiler-bundle": "7.2.*", // v7.2.4
        "zenstruck/browser": "^1.9.1", // v1.9.1
        "zenstruck/foundry": "^2.5" // v2.5.0
    }
}

Take a single-language Symfony app and turn it into a multilingual experience using the Translation component. You'll take Spacebar, a space-themed blogging platform, and convert it to support multiple languages—without overcomplicating the codebase.

You’ll learn how to:

  • Set up and configure Symfony’s Translation component
  • Translate routes and URLs for language-friendly navigation
  • Add a language switcher to your UI
  • Organize messages using catalogs and domains
  • Translate content in both PHP and Twig
  • Connect to third-party translation providers

Whether you're preparing your app for global users or just adding support for a second language, this course will give you the tools to do it right!

Next courses in the Symfony 7: Learn More Tricks section of the Symfony 7 Track!

2 Comments

Sort By
Login or Register to join the conversation
Davide-S avatar Davide-S 1 month ago

Will you also talk about the translation of doctrine entities?
...and how to handle translations with the symfony form system?
...and how to generate translated slug for each object?
...and how to manage nested tree of translated objects with translated slug? (a super-pro problem)

I've always preferred the knplabs/doctrine-behaviors solution but sadly is now abandoned.
I know that gedmo/doctrine-extensions could be an alternative but I don't like the fact that the developer have to choose a default locale and the translations are stored in a single big table and the integration with the form system is a bit more difficult

I have no clear solution for that problem.
A tutorial on that wold help a lot.
Thanks

| Reply |

Hey @Davide-S!

We aren't covering database translations in this course.... but stay tuned... I have a followup course that will address at least some of what you discuss... in an interesting way!

--Kevin

1 | Reply |

Delete comment?

Share this comment

astronaut with balloons in space

"Houston: no signs of life"
Start the conversation!