Java Properties
What are Java Properties files and what do you need to pay attention to before starting the translation process?
File Extensions |
.properties |
API Extension |
properties |
Import |
Yes |
Export |
Yes |
Pluralization supported? |
No |
Descriptions supported? |
Yes |
Format Options |
escape_single_quotes, omit_separator_space, crlf_line_terminators, escape_meta_chars |
Java Properties are standard config/localization files typically used by Java. This file format contains key-value pairs connected by a “=” sign. Apart from this, it does not have any other cascading element. “Values” in the file will always be parsed as a String type.
Sometimes there may be an issue of duplicate keys (the file contains two or more identical keys). Although such issues would generally not cause the program to break, values loaded later in the process would always overwrite the previous data. Therefore, while preparing the file for translation, it is always recommended to check if certain keys are duplicate. An easy way to do this is to put the properties files at issue into a Java IDE (e.g. Eclipse, IntelliJ). These apps would flag out the issue.
Format Options
Escape single quotes
Identifier |
escape_single_quotes |
Type |
boolean |
Upload |
Yes |
Download |
Yes |
Default |
true |
Description |
Escape single quotes with another single quote (e.g. I'm -> I''m ). |
Omit separator space
Identifier |
omit_separator_space |
Type |
boolean |
Upload |
No |
Download |
Yes |
Default |
false |
Description |
Skip the space before and after the separator sign (= ). |
CRLF line terminators
Identifier |
crlf_line_terminators |
Type |
boolean |
Upload |
No |
Download |
Yes |
Default |
false |
Description |
Use CRLF (Windows) line terminator chars. |
Escape meta chars
Identifier |
escape_meta_chars |
Type |
boolean |
Upload |
No |
Download |
Yes |
Default |
true |
Description |
Escape meta characters (! : = # ) |
Code Samples
boolean_key = --- true\n
empty_string_translation =
# This is the amazing description for this key!
key_with_description = Check it out\! This key has a description\! (At least in some formats)
key_with_line-break = This translations contains\na line-break.
nested.deeply.key = Wow, this key is nested even deeper.
nested.key = This key is nested inside a namespace.
null_translation =
pluralized_key.one = Only one pluralization found.
pluralized_key.other = Wow, you have %s pluralizations\!
pluralized_key.zero = You have no pluralization.
sample_collection = ---\n- first item\n- second item\n- third item\n
simple_key = Just a simple key with a simple message.
unverified_key = This translation is not yet verified and waits for it. (In some formats we also export this status)