Putting the locale in your URL

This video is available to view for members only.

Click here to Join!

Already a member?


A fundamental rule of the web is that a given URL should always return the same content, regardless of which user is looking at it.

This means we can't do any funny business such as deciding a logged in user should see our site in French, where a none-logged-in user sees the site in German.

Instead, we must put "things" in to the URL to ensure the content is always the same... on that URL. And for translations we do this by putting in the locale.

So whereas before this you may have had mysite.com/about - after following this process, you will have mysite.com/en/about, or mysite.com/fr/about - and each URL will display the content in the given language.

It's all about the locale.

Share This Episode

If you have found this video helpful, please consider sharing. I really appreciate it.

Episodes in this series

# Title Duration
1 An introduction to Symfony's Translation component 11:20
2 Putting the locale in your URL 10:35
3 Message Domains - crazy name, simple concept 08:13
4 How to handle Variables in translations 04:53
5 Pluralization - Johnny has 1 apple(s) 05:38
6 New in Symfony 2.5 - Generating new languages from the command line 03:07
7 New in Symfony 2.5 - Debugging Translations using the Command Line 05:15