To adjust the user interface or the output of a website, it is often the case that messages have to be localized. One the one hand, that means to translate words or sentences. On the other hand that means to translate also date and number formatting, etc. Java has a mechanism for such localization. In particular for the localization of messages: so called resource or message bundles. They can be backed up with property files, which is the way we use them in OpenCms. Each such properties file contains the key-value pairs. Keys are identifiers of messages. Values are localized messages.
Let's give a little "Hello World" example with English and German localization. English should serve as default language, if the requested localization is missing. To get a localized "Hello world", we need a key for the message, let's say hello.world
. Then we need an English and a German properties file that contains the key. The English file we name hello.properties
and it's content is: