Skip to content

Commit 1cb9d3d

Browse files
author
Jimmi Hansen
committed
Update README
1 parent 55e3803 commit 1cb9d3d

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,18 @@ The code for Language module that uses the [Languages Repo](https://github.com/U
33

44
## Reporting Issues
55
I'll fix any issue listed in [here](https://github.com/Upgration/Languages).
6+
7+
## Usage
8+
This is an example on how you can use this addon in your addon.
9+
10+
First you must instasitate the language like this:
11+
```lua
12+
MYLANG = LANG:Init('mylanguage', 'myaddon', 'myteam',function() -- this function can be used for calling any hooks that you might need when you've downloaded the needed language files
13+
hook.Run('mylanguagehook')
14+
end)
15+
```
16+
17+
Then you can use this for retriving the language phrases:
18+
```lua
19+
print(MYLANG:GetPhrase('myphrase', 'fallback')) -- The fallback is used if the server has a outdated language version, which shouldn't happen.
20+
```

lua/langs/test/sh_test.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ CURLANG = LANG:Init('english', 'coinflip', 'XeNiN',function()
44
end)
55

66
hook.Add('InitializeLanguage', 'teststest', function()
7-
print(CURLANG:GetPhrase('misc.Max', 'hitler'))
7+
print(CURLANG:GetPhrase('misc.Max', 'sad'))
88

99
end)
1010

1111
hook.Add( "HUDPaint", "HUDPaint_DrawABox", function()
12-
draw.SimpleText(CURLANG:GetPhrase('misc.Max', 'hitler'), "DermaDefault", 250,25, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT,TEXT_ALIGN_TOP)
12+
draw.SimpleText(CURLANG:GetPhrase('misc.Max', 'sad'), "DermaDefault", 250,25, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT,TEXT_ALIGN_TOP)
1313
end )

0 commit comments

Comments
 (0)