elstar IT

Fullstack | Java | Tech Speaker | Tech Coach | Frank van der Linden

  • About me
  • Blog license
  • My Open source projects

XPages tip: Multi language support for labels

05-03-2016 4 responses flinden68 development

multi languageBack in 2014 I wrote a blog about controlling the labels in a XPages application, via a web interface, backed by a property file which is inside the application.

One of the most wanted requests was multi language support. So I added configurable multi language support to my applications. I used it at several projects with success.

Language web interface

I added 2 pages to my administration part of the application, an language overview page and language page.

Language List

language page

When the language page will be saved, there is a check if it is a new language. If yes it will be added to the language list in my application bean AND it will create for this new language all the property documents, from the property file, with the Language stored in the property document.

As you can see, in the overview there are other interesting buttons.

  • Delete languages, will delete the selected languages, but also remove the property documents for the removed language.
  • Load languages will load all the property documents for the languages present in the overview.
  • Make default, there can be only one default language. I store the language preference in the User Preference document. When the user have no language preference set, it will take the default language.

All the property documents have now a language field.

Make it work

In the top bar of the application I have added an dropdown where the language codes are loaded.

Language dropdown

The preferred language of the user will be loaded first, when no preferred language is present the default language will be loaded.

When you select another language, the new language will be stored in the User preference document and the properties of the new language will be loaded.

 

Backend changes

In the backend classes, like the PropertyHandler, I added the language to the key in the methods who are getting the property value for that language.

And of course store the preferred language to the users preferences file.

So no big changes to the backend classes.

 

 

Tags: bootstrap, development, java, xpages

4 thoughts on “XPages tip: Multi language support for labels”

  1. Pingback: XPages tip: add a new language to your app - elstar IT
  2. Jesse Lindberg says:
    19-04-2016 at 19:44

    not sure if I understand it correctly. can you share it e.g. via openntf?

    Reply
    1. Frank van der Linden says:
      19-04-2016 at 20:10

      What do you not understand? Have you seen my other blogs about my way to implement multi language support. ( http://elstarit.nl/2016/03/08/xpages-tip-add-a-new-language-to-your-app/).
      May be I can make an example database, but that has to wait till this weekend if I can find time

      Reply
  3. Pingback: XPages tip: Demo code for multi language support - elstar IT

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • « Start contribution to the OpenNTF wiki
  • XPages tip: add a new language to your app »

Contact me

My name is Frank van der Linden and I am an independent software developer based in the Netherlands. The last 2 years I was awarded as IBM Champion. Also I am on the board of OpenNTF. My specialisations are Java, Web development and Domino.


If you want to hire me, please fill in the Contact form


IBM Champion web badge
Apache Logo

All the code on this blog are under the Apache License 2.0. For more details, see Apache License 2.0

Most recent posts

  • Engage 2020: Hello are you listening, There is stream for everything
  • Spring Cloud Function on Azure run locally
  • Deploy Spring Cloud Function to IBM Cloud
  • Speaking (again) at Engage in a Zoo
  • Congratulations, you’re an IBM Champion (again)!

Latest reactions

  • Spring Cloud Function on Azure run locally - elstar IT on Deploy Spring Cloud Function to IBM Cloud
  • flinden68 on Quick XPages tip: add Fullcalendar plugin to your application
  • Rajesh samal on Quick tip: Swagger support for Spring Webflux
  • dsieyx on Quick XPages tip: add Fullcalendar plugin to your application
  • John on Named as IBM Champion 2019

Archive

  • March 2020
  • February 2020
  • January 2020
  • October 2019
  • September 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • January 2019
  • December 2018
  • October 2018
  • September 2018
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • January 2018
  • December 2017
  • November 2017
  • October 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
  • October 2016
  • September 2016
  • August 2016
  • June 2016
  • May 2016
  • April 2016
  • March 2016
  • February 2016
  • December 2015
  • November 2015
  • October 2015
  • September 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • March 2015
  • February 2015
  • December 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014

Category

  • bluemix
  • business
  • cloudant
  • community
  • development
  • hrassistant
  • openntf
  • running
  • salesforce
  • Springboot
  • Tesla
  • trailrunning
  • Uncategorized
  • watson
  • OpenNTF
  • Collaboration Today
  • XSnippets
  • Stackoverflow
  • IBM Collaboration Solutions
  • Social Business Toolkit
  • About me
  • Dutch curriculum vitae
  • English curriculum vitae
  • Google+
  • LinkedIn profile
  • Twitter
  • Slideshare
  • Blog license
  • My open source projects