Serving content in several languages

Play comes with handy support for internationalization so that you can define the messages of your application in several languages and automatically select the language to use according to the user preferences (as defined by the Accept-Language request header).

When a user performs a request to a server from his web browser, this one usually sets an Accept-Language header according to the user preferences. For instance, in my case, it is the following:

Accept-Language:en,en-US;q=0.8,fr;q=0.6,fr-FR;q=0.4

This means that the language I prefer to read is English and then French. The preference level is defined by the q factor. If there is no q factor associated with a language (for instance, en, in the preceding ...

Get Play Framework Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.