Jump to content
  • 0

How to make translations for a table variable?


Compmike19

Question

I seem to have a problem on translations that are built with variables that I can't seem to correct. Any suggestions? The Age Traits and Craft Helper (with it's List Extender ##, List Header ##, and Note ##)  seem to be my biggest offenders.

 

Example: for the Age Trait

	Line 36778: LOG  : General     , 1673473497628> ERROR: Missing translation "Age 30"
	Line 36779: LOG  : General     , 1673473497629> ERROR: Missing translation "Age 40"
	Line 36780: LOG  : General     , 1673473497629> ERROR: Missing translation "Age 50"
	Line 36781: LOG  : General     , 1673473497630> ERROR: Missing translation "Age 60"

 

the LUA

local AGES = {
    30,
    40,
    50,
    60
}

local function Age_Init(age)
    local player = getSpecificPlayer(0)
    local levelBoost = MxIndexOf(AGES, age)
    for i = 0, Perks.getMaxIndex() - 1 do
        local perk = PerkFactory.getPerk(Perks.fromIndex(i));
        local parent = perk:getParent()
        local isNotPassive = parent ~= Perks.None and parent ~= Perks.Passiv
        local info = player:getPerkInfo(perk)
        local level = info and info:getLevel() or 0
        if perk and isNotPassive and level >= 1 then
            local k = 1
            repeat
                player:LevelPerk(perk, false);
                k = k + 1
            until (k > levelBoost)
            player:getXp():setXPToLevel(perk, player:getPerkLevel(perk));
        end
    end
end

for i, age in ipairs(AGES) do
    -- Exclude code credits to Fenris_Wolf https://discord.com/channels/136501320340209664/232196827577974784/964694443460530196
    local exclude = {}
    for j=1+i, #AGES do
        table.insert(exclude, "Age"..AGES[j])
    end

    ProfessionFramework.addTrait('Age' .. age, {
        name = "Age " .. age,
        description = "UI_trait_Age" .. age .. "desc",
        icon = "trait_Age" .. age,
        cost = 1,
        xp = {
            [Perks.Fitness] = -(MxIndexOf(AGES, age)),
        },
        exclude = exclude,
        OnNewGame = function(player, square, profession)
            Age_Init(age)
        end,
        OnGameStart = function(trait)

        end
    })
end

 

The Translation file, I've tried multiple variations

UI_EN =
{
    UI_trait_Age30 = "Age 30",
    UI_trait_Age40 = "Age 40",
    UI_trait_Age50 = "Age 50",
    UI_trait_Age60 = "Age 60",
    UI_EN_Age_30 = "Age 30",
    UI_EN_Age_40 = "Age 40",
    UI_EN_Age_50 = "Age 50",
    UI_EN_Age_60 = "Age 60",
    UI_Age_30 = "Age 30",
    UI_Age_40 = "Age 40",
    UI_Age_50 = "Age 50",
    UI_Age_60 = "Age 60",
    UI_trait_Age30desc = "When you start the game you will gain +1 to all your skills with a level above or equal to 1",
    UI_trait_Age40desc = "When you start the game you will gain +2 to all your skills with a level above or equal to 1",
    UI_trait_Age50desc = "When you start the game you will gain +3 to all your skills with a level above or equal to 1",
    UI_trait_Age60desc = "When you start the game you will gain +4 to all your skills with a level above or equal to 1",
}

 

Thanks in advance.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Fixed ...

 

    ProfessionFramework.addTrait('Age' .. age, {
        name = "UI_trait_Age" .. age,
        description = "UI_trait_Age" .. age .. "desc",

 changed the name = and removed the space in it

 

The other was Soul Filcher's Awesome Time for the List Header ##. List Extender ##, Note ##,

function shoppinglistFiller()
	local randomHeader = ZombRand(1, #SFRelax["ListHeaders"]);
	local header = SFRelax["ListHeaders"][randomHeader];
	local headerFilled = getText(getText(header), SFRelax["Forenames"][ZombRand(1, #SFRelax["Forenames"])], getRandomItemName(), getRandomItemName(), getRandomItemName());

removed the double getText() function on these fixed them, List Header ## example shown getText(getText(header)

 

function shoppinglistFiller()
	local randomHeader = ZombRand(1, #SFRelax["ListHeaders"]);
	local header = SFRelax["ListHeaders"][randomHeader];
	local headerFilled = getText(header, SFRelax["Forenames"][ZombRand(1, #SFRelax["Forenames"])], getRandomItemName(), getRandomItemName(), getRandomItemName());

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...