Localisation File Format
A description of the custom format used by Reloaded for localising.
The file format used by Reloaded3 for localization is designed to deliver a good tradeoff between:
- Human Readability (especially for non-programmers)
- Parsing Speed
Cheat Sheet
##
denotes the line is a comment[[KEY]]
marks an entry.
Entries
Translatable keys are represented in the following format.
[[KEY]]
Value
A key starts with [[
and ends with ]]
.
All text after ]]
is discarded.
The value is read from the start of the next line.
Standard style for keys uses the following
UPPER_SNAKE_CASE
- Shorthand or exact string as stored in text.
Comments
Comments may be represented by a ##
at the start of a line,
in which case the entire line is ignored by the parser
## This is a comment
[[KEY]]
Alternatively, it's possible to put comments next to the keys.
[[KEY]] ## This is a comment
Since all characters after ]]
are ignored until end of line.
Escape Characters
No characters are escaped. Every character is treated literally.
Lines that are not comments should simply not start with ##
or [[
.
As a workaround, you can use a Zero Width White Space
at the start of a line, if an escape is really needed.
New lines are saved as \n
. Any sequences of \r\n
should be converted to \n
.
Placeholders
Placeholders for string formatting may be included with {}
.
[[KEY]]
This is a string with a placeholder: {}
Multiple placeholders may also be used:
[[KEY]]
This is a string with multiple placeholders: {} and {}
These placeholders should map to a programming language's given string formatting system.
For example, in Rust, this would be format!(text(KEY), value1, value2)
and in C#
this would be string.Format(text(KEY), value1, value2)
.
For some languages, it may be necessary to manipulate the returned string to match the native format
upon initial file read. For example, a C# implementation might want to replace first {}
with {0}
.
Tip
An implementing library may also provide an export like get_text_formatted(KEY, values)
, where
values
is a list of strings to be inserted into the placeholders.
An Example
## Update 1.0.0 | 2024 April 1st
## Initial Release
[[ADD_AN_APPLICATION]]
Add an Application
[[CREATING_DEFAULT_CONFIG]]
Creating Default Config
[[SEARCH_MODS]]
Search Mods
## Update 1.1.0 | 2024 May 2nd
## Added Placeholder Text
[[MOD_LIST_DUMMY_TEXT]]
Reloaded3 is cool >w<! Go get some mods, silly!
## Update 1.2.0 | 2024 June 3rd
## Added Error Handling
[[ERROR_UNKNOWN]]
Unknown Error
[[ERROR_FAILED_TO_START_PROCESS]]
Failed to start the process. This generally happens due to one of the 2 issues:
- The program is configured to run as administrator (right click -> properties) but Reloaded is running in user mode.
- Interference from e.g. Antivirus software. Check your logs.
Here is the error returned from your OS {}
Syntax Highlighting
You may be able to get good syntax highlighting by setting your language as TOML.
This is what this wiki page does 😉