-
Notifications
You must be signed in to change notification settings - Fork 7
Localisation tables
Ever wondered why something like this:
gamemode.AddGameObjective(self.PlayerTeams.BluFor.TeamId, "EliminateOpFor", 1)
adds a game objective with nice text Locate and eliminate all threats in the area
instead of EliminateOpFor
? Localization files is why.
Simply create a .csv
in the
en
folder. Name it whatever you want but remember to:
- Keep the
.csv
extension, - steer clear of white spaces or special characters,
- note the file name you'll need it later.
Better yet copy one of the files existing in the en folder, rename it to whatever you like and use it as a template.
First line of the .csv
file has to be:
Key,SourceString,Comment
This line defines the order of data in each row. Now every following row should contain
of three strings each surrounded by double quotes "
and separated from each other with
commas ,
, like so:
"missionsetting_opforcount","Expected resistance","Opsboard"
This is where most of the magic happens. Key is the string Ground Branch will use to try and match the string from the lua script to a pretty text in the localisation file. Key has two parts separated by the first underscore:
-
prefix is the part before the first underscore and has to be one of the following:
-
objective
if it is supposed to go on the objective board, used bygamemode.AddGameObjective
-
summary
if it is supposed to be displayed in the after action report, used bygamemode.AddGameStat("Summary=...")
-
gamemessage
if it is supposed to be displayd as a in game message, used bygamemode.BroadcastGameMessage
-
missionsetting
if it is supposed to be displayed as a mission setting, this is not used by any function but will be used to "translate" mission settings.
-
- name this is the part that will be used to match the string provided in any of the lua functions mentioned above.
Note: missionsetting
is a special case - the name provided in the .csv
will be matched
against the names of the variables in the game mode settings table. Also name of the
missionsetting
should be all lower case.
is the pretty string that will be used instead of the key if the key matches.
can be anything you want and is mostly here for you. ;-)
First of all you'll need to define the name of the localization table you want to use in
your game mode. You can do that by adding a StringTables
variable to your gamemode in
the lua script. If I understand correctly you can add multiple string tables to a single
game mode, but did not try this.
local killConfirmed = {
...
StringTables = {"KillConfirmed"},
...
}
Now you start using the Keys you from your localisation file in your lua script.
Given a localistaion file
GroundBranch\Content\Localization\GroundBranch\en\KillConfirmed.csv
Key,SourceString,Comment
"missionsetting_opforcount","Expected resistance","Opsboard"
"objective_ExtractionPoint","Locate and eliminate all threats in the area.","Opsboard"
"gamemessage_HighValueTargetEliminated","HVT eliminated.","objective"
"summary_OpForLeaderEliminated","High Value Targets were eliminated.","AAR"
First tell the script where to look for the slugs:
local terroristhunt = {
...
StringTables = { "KillConfirmed" },
...
Then the missionsetting_opforcount
slug will match mission settings variable
OpForCount
like this:
...
Settings = {
OpForCount = {
Min = 0,
Max = 50,
Value = 15,
},
},
...
}
...
And following that the code below will match
-
ExfiltrateBluFor
withobjective_ExfiltrateBluFor
, -
HighValueTargetEliminated
withgamemessage_HighValueTargetEliminated
, and last -
OpForLeaderEliminated
withsummary_OpForLeaderEliminated
.
...
gamemode.AddGameObjective(self.PlayerTeams.BluFor.TeamId, "ExfiltrateBluFor", 1)
...
gamemode.BroadcastGameMessage("HighValueTargetEliminated", "Engine", 5.0)
...
gamemode.AddGameStat("Summary=OpForLeaderEliminated")
...