-
Notifications
You must be signed in to change notification settings - Fork 11
Localization: how translations work in Spore
Spore is available in different languages, so it's important to know how it manages to show different texts for different languages. For that, Spore uses a system called localization.
Basically, all the texts in the game are stored in different files than the places where they are used. Those files are called locale tables, are stored in the locale~
folder and use the .locale
extension. For example, imagine a creature part: there is one file that defines its properties, but that file doesn't have the part name; instead, it has a reference to a locale table that contains the name. Locale tables have a different version for every different language in the game, so Spore will pick the correct one according to the language you are playing on.
A locale table is made of multiple instances, which are just texts. To recognise and differentiate different texts, each instance has an ID associated, which is called the instanceID. It's just an 8 digit hexadecimal number (i.e. it can contain any number and abcdef
): for example 0x00000001
, 0x005f6ad4
,...
To know what text to use, an object in Spore (a conversation, a part, the user interface,...) uses a pair of two IDs as tableID!instanceID
, where tableID
is the name of the locale file (without the extension), and instanceID
is the ID of the text within that locale file.
For example, imagine we have this file in the locale~
folder, called my_space_tool.locale
:
0x00000001 Super-nuclear-bomb
0x00000002 Weapons of mass destruction are cool (if you are on the right end, I guess)
On the .prop
file that defines the space tool, we can use these texts like this:
texts spaceToolDescription
(my_space_tool!0x00000001) "PLACEHOLDER text"
end
texts spaceToolDetailDescription
(my_space_tool!0x00000002) "PLACEHOLDER"
end
Notice that since Spore will use the texts in the locale file, the text that comes after those tableID!instanceID
pairs is irrellevant.
When editing a file that uses locales in SporeModder FX, you can hover the mouse over the table/instance IDs; if you have that locale file in your project (or any of its source projects), the program will show you the text.
In the base game, the packages that have the locale files are stored in <SPORE folder>\Data\Locale\<lang-code>\
. In Galactic Adventures, they are stored in subpackages inside Spore_EP1_Locale_01.package
and Spore_EP1_Locale_02.package
.
If you want your mod to provide translations for different languages, it's really simple. Instead of putting the locale~
file directly in your mod, you have to put it in a subpackage, one for each language you want to support.
To add a translation for a particular language:
- If your mod doesn't have it, create the
animations~
folder. - Inside of it, create another folder with the name
<lang_code>.package.unpacked
.<lang_code>
is a unique identifier for the language, for example:en-us
for US English,en-gb
for British English,es-es
for Spanish,... (keep in mind that Spore doesn't support all the possible codes). - Inside of that folder, add the
locale~
folder with the the texts translated for that particular language.
Your mod structure would look something like this: