sulu-workshop
sulu-workshop copied to clipboard
04 - Add additional languages to the website
Add additional languages to the website
Goal
Our website is gaining traction in germany and france. To communicate with our new users in their native language we want to add german an french as additional languages and translate our existing content.
Steps
- Add the new languages to the
config/webspaces/example.xml
file - Run
bin/console sulu:document:initialize
to initialize the new languages - Change the url configuration in the same file
- Log into the admin UI with user "admin" and password "admin"
- Give the admin user permissions for the new languages (Contacts -> Edit Adam Ministrator -> Permissions -> Roles -> Add new languages).
- Add content in the new languages
- Implement a language switcher in your
templates/base.html.twig
Hints
- Use
{{ dump(urls) }}
in the Twig template to find out how Sulu provides urls for multiple languages
More Information
As Sulu is built for internationally focused companies, managing localized content is a core feature of the system. Sulu does not only handle different languages, but also allows to manage different variations of a single language among different countries.
Available localizations for the content of the website are defined in the webspace configuration file.
Links
- Next assignment pull request: 05 - Add a page template Event overview to the website
- Source file of this assignment: assignments/04.md