Author Topic: [How To] Add translation in custom race  (Read 3227 times)

rostex

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
[How To] Add translation in custom race
« on: March 09, 2011, 01:58:00 PM »
First of all you need to download race in .sp format.
So, then open .sp file in notepad.

Add this line in public OnPluginStart()
Code: [Select]
LoadTranslations("w3s.race.<shortname>.phrases");
<shortname> - short name of race. For example paladin => w3s.race.paladin.phrases

Then you need to edit some description in public OnWar3LoadRaceOrItemOrdered2()
Example code without translation
Code: [Select]
thisRaceID=War3_CreateNewRace("Full_race_name","Short_race_name");
SKILL_DEFENSIVE=War3_AddRaceSkill(thisRaceID,"Name_of_Skill1","Description_of_Skill1",false,4);
SKILL_OFFENSIVE=War3_AddRaceSkill(thisRaceID,"Name_of_Skill2","Description_of_Skill2",false,4);
SKILL_HEALING=War3_AddRaceSkill(thisRaceID,"Name_of_Skill3","Description_of_Skill3",false,4);
ULT_OVERDRIVE=War3_AddRaceSkill(thisRaceID,"Name_of_Skill4","Description_of_Skill4",true,4);
War3_CreateRaceEnd(thisRaceID);

It should look like that
Code: [Select]
thisRaceID=War3_CreateNewRaceT("paladin");
SKILL_DEFENSIVE=War3_AddRaceSkillT(thisRaceID,"Name_of_Skill1",false,4);
SKILL_OFFENSIVE=War3_AddRaceSkillT(thisRaceID,"Name_of_Skill2",false,4);
SKILL_HEALING=War3_AddRaceSkillT(thisRaceID,"Name_of_Skill3",false,4);
ULT_OVERDRIVE=War3_AddRaceSkillT(thisRaceID,"Name_of_Skill4",true,4);
War3_CreateRaceEnd(thisRaceID);

Pay attention on T after War3_AddRaceSkill. Only with this code translation would be work correctly.
Yes, you need to remove "Description_of_Skill". We add description later. "Name_of_Skill" should be without space.
Save file...

Ok, now creat a txt file and we add translation.
Example of translation:
Code: [Select]
"Phrases"
{
//<shortname>_RaceName
"<shortname>_RaceName"
{
"en" "Full_race_name"
}

//skills:
//<shortname>_skill_<SkillNameIdentifier> for the skill name
//<shortname>_skill_<SkillNameIdentifier>_desc for the skill description
"<shortname>_skill_<SkillNameIdentifier>"
{
"en" "Name of Skill1"
}
"<shortname>_skill_<SkillNameIdentifier>_desc"
{
"en" "Description of Skill4"
}

"<shortname>_skill_<SkillNameIdentifier>"
{
"en" "Name of Skill1"
}
"<shortname>_skill_<SkillNameIdentifier>_desc"
{
"en" "Description of Skill4"
}

"<shortname>_skill_<SkillNameIdentifier>"
{
"en" "Name of Skill1"
}
"<shortname>_skill_<SkillNameIdentifier>_desc"
{
"en" "Description of Skill4"
}

"<shortname>_skill_<SkillNameIdentifier>"
{
"en" "Name of Skill1"
}
"<shortname>_skill_<SkillNameIdentifier>_desc"
{
"en" "Description of Skill4"
}

}

This code have same hints but im repeat that

"<shortname>_RaceName" - it easy... example: "paladin_RaceName"
"<shortname>_skill_<SkillNameIdentifier>" - for the skill name. Example: "paladin_skill_DefensiveAura"
"<shortname>_skill_<SkillNameIdentifier>_desc" - for the skill description. Example: "paladin_skill_DefensiveAura_desc"

If you want to add another language you need edit "en" to your language (for example "ru") and translate description.

How it looks...
Code: [Select]
"Phrases"
{
//<shortname>_RaceName
"paladin_RaceName"
{
"en" "Paladin"
}

//skills:
//<shortname>_skill_<SkillNameIdentifier> for the skill name
//<shortname>_skill_<SkillNameIdentifier>_desc for the skill description
"paladin_skill_DefensiveAura"
{
"en" "Defensive Aura"
}
"paladin_skill_DefensiveAura_desc"
{
"en" "Give your teammates extra armor. You receive half of the benefits."
}

"paladin_skill_OffensiveAura"
{
"en" "Offensive Aura"
}
"paladin_skill_OffensiveAura_desc"
{
"en" "Give your teammates extra damage. You receive half of the benefits."
}

"paladin_skill_HealingAura"
{
"en" "Healing Aura"
}
"paladin_skill_HealingAura_desc"
{
"en" "Give your teammates passive regeneration. You receive half of the benefits."
}

"paladin_skill_AuraOverdrive"
{
"en" "Aura Overdrive"
}
"paladin_skill_AuraOverdrive_desc"
{
"en" "Activate all auras at once, giving you full benefits."
}

}

Finally, save your translation.
Translation should named w3s.race.<shortname>.phrases.txt (example: w3s.race.paladin.phrases.txt)

I think thats all...
You need to compile the .sp file, upload into the server, restart your server...

P.S. Sorry for English. If you find some mistake correct me...
« Last Edit: April 06, 2011, 06:02:53 PM by Ownz »

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: [How To] Add translation in custom race
« Reply #1 on: May 14, 2012, 06:05:01 PM »
yes he did miss the part of changing the phrases in prints inside the races themselves