• Print

Author Topic: TTT: Adding Translations to an existing language  (Read 4782 times)

0 Members and 1 Guest are viewing this topic.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
TTT: Adding Translations to an existing language
« on: August 06, 2018, 01:29:22 pm »
So I'm currently working on a project that adds more roles to TTT, and I'm trying to figure out how add custom translation fields to the LANG.

For example, TTT's flaregun file has this:

Code: Lua
  1. SWEP.EquipMenuData = {
  2.         type = "item_weapon",
  3.         desc = "flare_desc"
  4.     }
  5.  

Which uses this from english.lua:
Code: Lua
  1. L.flare_name      = "Flare gun"
  2. L.flare_desc      = [[
  3. Can be used to burn corpses so that
  4. they are never found. Limited ammo.
  5.  
  6. Burning a corpse makes a distinct
  7. sound.]]

My question is, can I add translations for this without actually editing the english.lua file?
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: TTT: Adding Translations to an existing language
« Reply #1 on: August 07, 2018, 05:53:06 am »
See if this works (client-side): LANG.AddToLanguage( "english", "flare_name", "Flare gun" )

You may have to call the function inside an Initialize hook.

The function definition and some comments can be found in garrysmod/gamemodes/terrortown/gamemode/cl_lang.lua#L47.
« Last Edit: August 07, 2018, 08:52:14 am by Timmy »

  • Print