Java Properties Files

Updated 12. May 2010 (for RC-WinTrans 9)

 

RC-WinTrans supports the translation of Java properties files created with Sun Microsystems Java development platforms J2SE/EE/ME.  Properties files are used for what are known as resource bundles, which contain locale-specific strings (objects in general).

 

The image below shows the RC-WinTrans application with the Projects Overview tab shown on the left and the Project window shown on the right.  The Text Table view (top, right) lists the English source texts and the Japanese translation of the selected Java properties file.  The Source File tab view (right, bottom) shows the original contents of the Java source file (the currently selected text is highlighted).

 

 

 

Character Encoding

Properties files generated/used by Sun development platforms are encoded as ASCII with Unicode escape sequences. RC-WinTrans supports the following character encodings for source files (input) and can write target files in the following formats:

Unicode UTF-8.

UTF-16 (little-endian).

ANSI

ANSI with escaped Unicode characters.

 

Unicode Character Escapes in Java Properties Files

The standard for Java properties files is ANSI file encoding.  On the one hand this means that each character uses exactly one byte in the file.  On the other Java is Unicode-aware, so it is necessary to transport characters not included in the standard ANSI character set(any character with a Unicode character value greater than 127).  In Java properties files such characters are escaped, i.e., they are written as the sequence"\u" followed by a four-digit representation of the hexadecimal Unicode character value of the character (e.g., the German "sz" ligature (ß) is written as "\u00df".

 

Related topics...

 

 

Comments

Comments in a Java properties file can be read by RC-WinTrans and assigned to an item.  A comment text is taken over as a "note" for an item (translation unit) in the project's database.

 

To read and assign Java comments as notes the correct settings must be enabled:

1.

Open RC-WinTrans' Options dialog box (Tools menu) and select the File Converters tab.

2.

Select the list entry for the Java properties files converter ("Java properties file") and press the Options button.

3.

Check the option "Read comment line(s) before an item as a note."

 

 

Comment Lines

As the comment for item The Java properties files converter reads any text from comment lines directly above the line with the resource item.  Comment lines are lines beginning with a number character (#) or semicolon (;).

 

EXAMPLE:

# Comment start               (Comment)

# Comment too                 (Comment)

fileopenID = Open file        (<-- Item to which the text in the two comment lines is assigned.)

 

 

Source File View

The source Java properties file can be viewed in the Source File tab of the Project window.

 

 

 

Figure:  RC-WinTrans' Source File view showing a German message string with the ID "msg_closedoc" in one line (line 10).  The second variant shows a forced line length (lines 19 to 22).