Table of contents

How is Lingohub handling properties files comments? Here is another look at example resource files used in app localization in our ongoing series on file formats used in software localization here at Lingohub and elsewhere.

.properties files are commonly used in the Java world (and related platforms, for example they are used for the upcoming FirefoxOS apps). There is no real standard, and various dialects exist. Let's look at, for example, how properties files comments are handled.

When using properties files in your localization project, Lingohub expects that:

  • key-value pairs are delimited with the equal character (=), and terminated by a new line. If the value should continue in the next line, the line should end with backslash ().
  • a place-holder can have this form: {name}, where name can consist of any number of non white space characters
  • comment lines start with hash (#) or exclamation mark (!), and everything up to the end of line is treated as a comment
  • a comment is assigned to the next key-value pair unless there are any blank lines in between
  • Java defines .properties files to be encoded in ISO-8859-1 with \u... and \x... escaping of non ASCII characters, but we allow users to choose their own settings

.properties files comments examples

# this comment is ignored because it is not directly followed by a key-value pair

! comments in .properties files can start with exclamation mark
hello_user = Hello {username}

\## the value can continue to the next line if the previous line ends with a backslash

welcome_message = Welcome back,  
we have missed you

\## multi line comments belong to the next key value pair

\## as long as they are not interrupted by a white line

visit_count = this is your {visit} visit to our site


Try lingohub 14 days for free. No credit card. No catch. Cancel anytime