Skip to content

Language Module

George Petrou edited this page Jan 1, 2018 · 10 revisions

About this module

This module handles all text localizations used in the gamemode. Any files in addons/whatever/tttlanguages/ will be loaded as a new language. The file name will behave as the language ID so keep it simple. You can override built in TTT languages by making your new language have the same file name.

Functions

TTT.Languages.GetServerDefaultLanguage - Shared

  • Returns: String of current server default language.

TTT.Languages.GetClientLanguage - Client

  • Returns: String of client's currently set language.

TTT.Languages.GetTable - Client

  • Returns: Table of all available language phrases and their translations for the client's current language.

TTT.Languages.GetPhrase - Client

  • Desc: Given a phrase, gives back a corresponding string of text according to the client's current language.
  • Arg One: String, phrase id.
  • Arg Two: Vararg, if the phrase has any %s in it, these will substitute into the string.
  • Returns: String, translated and with any substitutions.

TTT.Languages.AddPhrase - Client

  • Desc: Adds a new phrase to a given language, needs to be re-added after map changes.
  • Arg One: String, phrase for the translation.
  • Arg Two: String, language ID for what language this phrase is for. You can use 'ttt_language_list' to find the language IDs.
  • Arg Three: String, translated phrase.

TTT.Languages.SetServerDefaultLanguage - Server

  • Desc: Sets the server default language.
  • Arg One: String, language ID.

TTT.Languages.IsValid - Shared

  • Desc: Sees if the given language ID is valid.
  • Arg One: String, language ID.
  • Returns: Boolean, is the language ID valid on this server.

TTT.Languages.Initialize - Shared

  • Desc: Initializes the language system. You can call this to update any changes to language files.

Commands

ttt_language - Client

  • Desc: Lets the client's current language. Use 'ttt_language_list' to see available languages.

ttt_language_list - Shared

  • Desc: Prints all available languages on the server.

ttt_language_default - Server

  • Desc: If given no arg, returns the server's default language. If given an arg, sets the server's default language.
  • Arg One: (Optional) If supplied with a valid language ID, this will become the new server default language.

Home

Modules

Clone this wiki locally