Locsplit - Oinite12/balatro-modding-modules GitHub Wiki
Locsplit is a function that allows localization files to be split into smaller localization files that are easier to manage and navigate.
Initial confgiuration
It is recommended that the function locsplit
be elevated to a global scope, either by adding the function to a global variable, or adding the function to a global table (i.e. G
). A guide can be found at the bottom of the file.
Usage
On the main localization file (e.g. en-us.lua
), the localization table must be assigned to a variable. Following that, the function locsplit
needs to be called; it takes two parameters, the first being the localization table, and the second being the current file name, excluding extension. For example, locsplit(localizationTable, "en-us")
. Then the localization table is returned.
In the localization folder, create a folder with the same name as the localization file (e.g. en-us
), then create one or both of the folders descriptions
and misc
; these folders correspond to the localization table property descriptions
and misc
respectively. Finally, in either folder, create a Lua file with the name being a property of descriptions
or misc
. This file should return a table containing localization entries.
Example
First, en-us
has the following contents:
-- initial functions...
local loc = {
descriptions = {
Back = {...}
},
misc = {...}
}
locsplit(loc, "en-us")
return loc
To prepare Joker localizations in en-us, the file should have the path localization/en-us/descriptions/Joker.lua
and contain the following contents:
-- initial functions...
return {
j_joker = {
name = "...",
text = {},
}
}