language/Add

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Created page with "{{Func |Name=Add |Parent=language |Description=Adds a language item. Language placeholders are replaced with full text in Garry's Mod once registered with this function. |...")
 
(Add missing information about number sign)
Line 1: Line 1:
 
{{Func
 
{{Func
|Name=Add
+
|Description=Adds a language item. Language placeholders preceded with "#" are replaced with full text in Garry's Mod once registered with this function.
|Parent=language
+
|Description=Adds a language item. Language placeholders are replaced with full text in Garry's Mod once registered with this function.
+
 
|Realm=Client
 
|Realm=Client
 
|IsClass=No
 
|IsClass=No
 +
|Name=Add
 +
|Parent=language
 
}}
 
}}
 
{{Arg
 
{{Arg
 
|type=string
 
|type=string
 
|name=placeholder
 
|name=placeholder
|desc=The key for this phrase.
+
|desc=The key for this phrase, without the preceding "#".
 
}}
 
}}
 
{{Arg
 
{{Arg
Line 17: Line 17:
 
}}
 
}}
 
{{Example
 
{{Example
| Description = Small excerpt from a STOOL named cooltool. It has been registered as cooltool.
+
|Description=Small excerpt from a STOOL named cooltool. It has been registered as cooltool.
| Code = language.Add("Tool_cooltool_name", "The really cool tool")
+
|Code=language.Add("Tool_cooltool_name", "The really cool tool")
 
language.Add("Tool_cooltool_desc", "Do some random cool stuff.")
 
language.Add("Tool_cooltool_desc", "Do some random cool stuff.")
 
language.Add("Tool_cooltool_0", "Left-click: Cool Stuff. Right-click: Nothing.")
 
language.Add("Tool_cooltool_0", "Left-click: Cool Stuff. Right-click: Nothing.")
 
language.Add("Undone_cooltool", "Cool stuff has been undone.")
 
language.Add("Undone_cooltool", "Cool stuff has been undone.")
| Output = When the player presses undo, "Cool stuff has been undone" will be shown. The cooltool's name will be "The really cool tool". Below that, where the description is shown, "Do some random cool stuff." will be shown. Below that, where the instructions or additional notes for the tool are shown, it will display "Left-click: Cool Stuff. Right-click: Nothing.".
+
|Output=When the player presses undo, "Cool stuff has been undone" will be shown. The cooltool's name will be "The really cool tool". Below that, where the description is shown, "Do some random cool stuff." will be shown. Below that, where the instructions or additional notes for the tool are shown, it will display "Left-click: Cool Stuff. Right-click: Nothing.".
 
}}
 
}}

Revision as of 15:18, 28 February 2016

 language.Add( )

Contents

Description

Adds a language item. Language placeholders preceded with "#" are replaced with full text in Garry's Mod once registered with this function.

Arguments

string placeholder

The key for this phrase, without the preceding "#".

Arguments

string fulltext

The phrase that should be displayed whenever this key is used.

Examples

Example

Small excerpt from a STOOL named cooltool. It has been registered as cooltool.

language.Add("Tool_cooltool_name", "The really cool tool")
language.Add("Tool_cooltool_desc", "Do some random cool stuff.")
language.Add("Tool_cooltool_0", "Left-click: Cool Stuff. Right-click: Nothing.")
language.Add("Undone_cooltool", "Cool stuff has been undone.")

Output:

When the player presses undo, "Cool stuff has been undone" will be shown. The cooltool's name will be "The really cool tool". Below that, where the description is shown, "Do some random cool stuff." will be shown. Below that, where the instructions or additional notes for the tool are shown, it will display "Left-click: Cool Stuff. Right-click: Nothing.".
Personal tools
Navigation