O'Reilly logo

Lift Application Development Cookbook by Gilberto T. Garcia Jr.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Localizing templates

Sometimes, applications or websites we build need to support multiple languages. Lift supports this requirement by allowing us to localize templates, and offers a powerful yet simple way to choose which template to use when rendering the page.

In this recipe, we'll learn how to localize templates and texts that will be loaded dynamically for our applications or websites.

Getting ready

  1. Create a new project and the following three bundle files in the src/main/resources/i18n folder:
    • The resources.properties file
    • The resources_de.properties file
    • The resources_fr_FR.properties file
  2. The resources.properties file will have the following content:
    menu.home=Home menu.static=Static dynamic.text=Some dynamic text welcome.text= Welcome to your ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required