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

0 Members and 1 Guest are viewing this topic.

Offline iViscosity

  • Hero Member
  • *****
  • Posts: 775
  • Karma: 50
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 a PM or Join my Discord!.
--==[ Links ]==--
Steam
YouTube
Steam Group (feel free to join!)
Discord

Quote from: Steve Jobs
Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven't found it yet, keep looking. Don't settle. As with all matters of the heart, you'll know when you find it. And, like any great relationship, it just gets better and better as the years roll on. So keep looking until you find it. Don't settle.

Offline Timmy

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 185
  • Karma: 149
  • Code monkey
    • ULX Unofficial Documentation
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 »