Roody:2d

Roody:2d

Not enough ratings
Localization format
By redinator2000
How to set up a folder structure and modify files to create a translation pack for Roody:2d
   
Award
Favorite
Favorited
Unfavorite
Localization Packs
Localization folder
Almost all the text in Roody:2d (the exceptions being the title screen, the debug console, and the display block) is loaded from localization files. For officially supported languages (english), the text is in these files
(Roody:2d install folder)/content/localization/english_blocks.txt (Roody:2d install folder)/content/localization/english_hud.txt (Roody:2d install folder)/content/localization/english_menu.txt (Roody:2d install folder)/content/localization/ ... et cetera ...
The contents of all localization .txt files are UTF-8 encoded.
Their file names are ASCII. File names follow the format
[language]_[optional_organizational_file_name].txt
[language] is the name that will be used to select the language in configuration files. Do not put an underscore or space in the middle of [language].
[optional_organizational_file_name] can be any string, or omitted.
All the contents can just be in one large
[language].txt
but it may be easier to split it up into separate files.

Custom folder
For custom languages, localization files can be loaded from
(Roody:2d install folder)/custom/piratespeak_pack_v1/localization/pirate_blocks.txt (Roody:2d install folder)/custom/piratespeak_pack_v1/localization/pirate_hud.txt (Roody:2d install folder)/custom/piratespeak_pack_v1/localization/pirate_menu.txt (Roody:2d install folder)/custom/piratespeak_pack_v1/localization/ ... et cetera ...
The "piratespeak_pack_v1" folder can be named anything. When distributing a custom language pack, distribute the "piratespeak_pack_v1" folder.

Language command
The Roody:2d debug console can be opened by pressing the tilde key ~. It is above the Tab key on most keyboards.
To change langues, use the console command
language <string>
Where <string> is the [language] in the name of localization files. NOT the folder name of the pack.
language english language set to english language something_that_doesnt_exist "something_that_doesnt_exist" is not a supported language language piratespeak_pack_v1 "piratespeak_pack_v1" is not a supported language language pirate_blocks.txt "pirate_blocks.txt" is not a supported language language pirate language set to pirate

The 16x16 text style
Roody:2d has "text styles" that define the font and some meta data for a font.
The default text style for Roody:2d is pixel_8 with the font PressStart2p.ttf. It has very limited unicode support.



There is another text style, pixel_16 with the font GnuUnifontFull-Pm9P.ttf. It has much better unicode support.



You can change text style to pixel_16 in the graphics options menu by setting font to 16x16, or by running the command
text_style pixel_16


Automatic configuration
If a user is installing a language pack, they probably want it to load automatically.
Create this text file
(Roody:2d install folder)/custom/piratespeak_pack_v1/config/autoexec.cfg
Open it with a text editor and write the commands you want to run on Roody:2d start up
language pirate text_style pixel_16
Text File Format
A snippet of english_blocks.txt
#natural category BLOCK dirt =dirt BLOCK_TITLE dirt =Dirt BLOCK_TUTORIAL dirt =Grass will spread better with {BLOCK_STATE light}. BLOCK grass =grass BLOCK_TITLE grass =Grass BLOCK_TUTORIAL grass =Plant matter that can be squished into nothing. BLOCK sediment =sediment BLOCK_TITLE sediment =Sediment BLOCK_TUTORIAL sediment =It's not quite {BLOCK dirt} and not quite {BLOCK stone}.
"#" at the start of a line denotes a comment line

Every non-comment line follows the format of
key =display text
Everything on the left side of the "=" forms the key, and everything on the right side of the "=" forms the text that will be displayed. There can be any amount of whitespace before the "=".
If a certain key is missing, roody2d will display the key string with asterisks.



Since the source code of Roody:2d is written in English, many keys and display texts are similar for the official English localization files. Do not change they keys, only change the values.
BLOCK platform=platform
BLOCK platform=plank (AR!)
Text values end at the newline, unless the line ends in a backslash. A backslash can make multi-line text.
BLOCK_TUTORIAL water=Flows out of the way.\ Can be found naturally along the world surface before researching {RESEARCH rehydration}.



Most keys follow a format
KEY_TOPIC key_name=display text
KEY_TOPIC is mostly just organizational, but some KEY_TOPICs have special colors for sub localizations.


BLOCK_TITLE also has the same color as BLOCK
ENTITY_TITLE also has the same color as ENTITY

Sub-Localizations
Localization texts can reference other translation keys with {}
another translation text=treasure BLOCK_TUTORIAL core_ore=This {another translation text} be burried deep underground.


In places that display a lot of text, like the guidebook, WAILA, and tutorial messages, this is where the KEY_TOPIC colors appear
BLOCK core_ore=core ore BLOCK_TUTORIAL core_ore=This {BLOCK core_ore} be burried deep underground.


It is possible add new keys just to get the color, but the KEY_TOPIC colors should only be used appropriately.
BLOCK core_ore plural=core ores ENTITY i just wanted deep to be green=deep BLOCK_TUTORIAL core_ore=These {BLOCK core_ore plural} be burried {ENTITY i just wanted deep to be green} underground.



English specific modifiers
Creating individual keys for every permeation of capitalized and plural is tedious.
BLOCK core_ore =core ore BLOCK core_ore plural=core ores BLOCK core_ore capitalized=Core ore BLOCK core_ore capitalized plural=Core ores
Sub-localizations have can have modifiers by appending a |
These modifiers are English specific, so when translating to a different language, this will only be of use when reading the official English localization files.

Character
Effect on English text
^
capitalizes the first letter
v
uncapitalizes the first letter
s
plural. adds "s" or "es" to the end of the string
d
past tense. adds "d" or "ed" to the end of the string
p
possessive. adds "'" or "'s" to the end of a string
b
add the {} around the string
BLOCK core_ore=core ore BLOCK_TITLE core_ore={BLOCK core_ore|^} BLOCK_TUTORIAL core_ore={BLOCK core_ore|^s} be burried deep underground.


Show Input Bindings
Text can show the currently bound key of actions with []. When translating, do not change the string inside the [], it is not displayed to the player.
BLOCK_TUTORIAL chair=So relaxing, time just seems to slip away when you sit [down] in it. [exit_chair] to exit.


It automatically updates when keys are rebound



Multiple inputs are concatenated with the 2 space characters and the translation key OPERATOR or
OPERATOR or=or
The names of inputs, like "RAlt" or "Delete" are not translatable.