diff --git a/guide.lua b/guide.lua index a8c5f94..52d8a04 100644 --- a/guide.lua +++ b/guide.lua @@ -66,9 +66,9 @@ local function createMachineInformationTable(fields,machineName,num) local fieldLabels={ inputVoltage="Input voltage level", outputVoltage="Output voltage level", - voltage="Voltage", - lowVoltage="Low voltage", - highVoltage="High voltage", + voltage="Voltage level", + lowVoltage="Low voltage level", + highVoltage="High voltage level", damageRed="Damage reduction", recipe="Recipe type", powerCapacity="Power capacity", @@ -87,7 +87,7 @@ local function createMachineInformationTable(fields,machineName,num) }) end - return createTable(rows,false,string.format("Figure %d. Information for %s",(num or 1),machineName)) + return createTable(rows,false,S("Figure @1. Information for @2",(num or 1),machineName)) end local pages={ @@ -207,7 +207,7 @@ local pages={ [[ ||Canning Machine|| - ||Canning Machine is used to move certain fluid from one item to another. The common usage is to refill fuel in Jetpack or Fuel Can.|| + ||Canning Machine is used to move certain fluid from one item to another. The common usage is to refill fuel in Jetpack or Fuel Can.|| ]], createMachineInformationTable({ @@ -1887,7 +1887,16 @@ local pages={ local function preprocessHypertext(content,vars) -- Find and replace strings which should be translated, this pattern matches any string that doesn't include | which is contained within || at both ends content=string.gsub(content,"||([^|]+)||",function(sourceString) - return S(sourceString) + -- Replace all sequences which should be treated as variables inside translation with format string + local trFormatIndex=1 + local trFormatValues={} + sourceString=string.gsub(sourceString,"{{([^{}]+)}}",function(var) + local result=string.format("@%d",trFormatIndex) + trFormatIndex=trFormatIndex+1 + table.insert(trFormatValues,vars[var] or "nil") + return result + end) + return S(sourceString,unpack(trFormatValues)) end) -- Replace all sequences which should be treated as variables with values provided in vars