Translate Java .properties and .xml files

WebTranslateIt supports Java .properties and .xml files.

.xml file example

Here’s an example of Java .xml file. WebTranslateIt imports instructions embbeded in a <comment></comment> tag.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
  <comment>Rhyme</comment>
  <entry key="seven-eight">lay them straight</entry>
  <entry key="five-six">pick up sticks</entry>
  <entry key="nine-ten">a big, fat hen</entry>
  <entry key="three-four">shut the door</entry>
  <entry key="one-two">buckle my shoe</entry>
</properties>

.properties file example

.properties files can be really complex. You will find below several examples showing what WebTranslateIt can handle.

If you upload a file encoded as ISO-8859-1, WebTranslateIt will generate files encoded in ISO-8859-1, which special characters using UTF escape codes. Otherwise, if your file is encoded as UTF-8, WebTranslateIt will generate files encoded in UTF-8 containing UTF-8 characters.

Encoding Detection

WebTranslateIt does its best to detect the encoding of files but it’s not very reliable when working with English files which do not contain any foreign characters. Besides it isn’t safe to assume that .properties files are UTF-8 encoded (most of them on WTI are ISO-8869 encoded).

You can force the encoding of the files by adding a special comment at the very top of your master file and uploading it to WebTranslateIt:

# encoding: UTF-8
key_1 = text
key_2 = text
key_3 = text

Layout

WebTranslateIt supports strings with double quotes, single quotes, without quotes. This example highlights how strings can be laid out.

# Double quotes:
key = "A simple segment."
# Single quotes:
key2 = 'Another segment.'
# No quotes:
key3 = hello
# A multi-line segment with quotes:
multiLine="first line
second line
another line"
# A multi-line segment with no quotes:
message = Welcome to \
          WebTranslateIt!

Keys can contain spaces but spaces must be escaped by a backslash (\).

key\ with\ spaces = hi!

Key-values can be separated by an equal sign (=) or by a colon (:).

key = value
key2=value
key3: hey!
key4 : hello!

Translator instructions can start by a # or !.

# this is a developer instruction
key = value
! The exclamation mark can also mark text as an instruction.
key2 = value
# You can also write instructions
# On several lines
key3 = value

We also support .properties files containing plural segments as used by Web L10N.