Skip to content

Internationalization in Symfony

Implement a basic field-level translation in a Symfony project.

Alternatively, open SettingsInternationalizationLanguages and add Spanish (es).

  1. In the article content type block, set the title and content fields as Translatable.
  2. Open each article, select the Spanish language, and add translations to every field. You can also use AI Translations.

In the code editor, update the route configuration to support the language path.

config/routes/storyblok.yaml
resource: '@StoryblokBundle/config/routes/webhook.php'
storyblok_content_type:
resource: '@StoryblokBundle/config/routes/content_type.php'
prefix:
es: '/es'
en: ''

The Symfony bundle automatically handles the multilingual routing and fetches the content that matches the locale prefix.

To configure the language in the controller logic or the templates, access the current locale using the request object.


Was this page helpful?

What went wrong?

This site uses reCAPTCHA and Google's Privacy Policy. Terms of Service apply.