GetLocalization: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{Client function}} __NOTOC__ {{New items|4.0132|1.4| This function gets the player's localization setting as he/she has set in his/her MTA client. }} ==Syntax== <syntaxhighlight lang="lua"> t...") |
No edit summary |
||
Line 2: | Line 2: | ||
__NOTOC__ | __NOTOC__ | ||
{{New items|4.0132|1.4| | {{New items|4.0132|1.4| | ||
This function gets the player's localization setting as he/she has set in his/her MTA client. | This function gets the player's keyboard localization setting as he/she has set in his/her MTA client. | ||
}} | }} | ||
==Syntax== | ==Syntax== | ||
Line 15: | Line 15: | ||
==Example== | ==Example== | ||
This example outputs simple ''Welcome'' message at the resource start (also when player joins the game if the resource is already running). | This example outputs a simple ''Welcome'' message in different languagues at the resource start (also when player joins the game if the resource is already running). Please note that this function returns the keyboard localization setting, and it can be different from the real localization of the player. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
local msg = {cs = "Vítejte", fr = "Accueil", de = "Willkommen", pl = "Powitanie"} | local msg = {cs = "Vítejte", fr = "Accueil", de = "Willkommen", pl = "Powitanie"} |
Revision as of 10:37, 17 May 2014
Syntax
table getLocalization ( )
Returns
Returns a table with the following entries:
- code : The language code (eg. "en_US" for "English (United States)" or "ar" for "Arabic").
- name : The name of the language (eg. "English (United States)" or "Arabic").
Example
This example outputs a simple Welcome message in different languagues at the resource start (also when player joins the game if the resource is already running). Please note that this function returns the keyboard localization setting, and it can be different from the real localization of the player.
local msg = {cs = "Vítejte", fr = "Accueil", de = "Willkommen", pl = "Powitanie"} addEventHandler("onClientResourceStart", resourceRoot, function () local languageCode = getLocalization()["code"] if msg[languageCode] then --Check if the message is avaible in client's language outputChatBox(msg[languageCode] .. "!") --Output it else outputChatBox("Welcome!") --Output English for any other language end end)
See Also
- createTrayNotification
- downloadFile
- getDevelopmentMode
- getKeyboardLayout
- getLocalization
- isShowCollisionsEnabled
- isShowSoundEnabled
- isTransferBoxAlwaysVisible
- isTransferBoxVisible
- isTrayNotificationEnabled
- setClipboard
- setDevelopmentMode
- setTransferBoxVisible
- setWindowFlashing
- showCol
- showSound
- Shared
- addDebugHook
- base64Decode
- base64Encode
- debugSleep
- decodeString
- encodeString
- fromJSON
- generateKeyPair
- getColorFromString
- getDevelopmentMode
- getDistanceBetweenPoints2D
- getDistanceBetweenPoints3D
- getEasingValue
- getNetworkStats
- getNetworkUsageData
- getPerformanceStats
- getRealTime
- getTickCount
- getTimerDetails
- getTimers
- getFPSLimit
- getUserdataType
- getVersion
- gettok
- isTransferBoxVisible
- setTransferBoxVisible
- hash
- inspect
- interpolateBetween
- iprint
- isOOPEnabled
- isTimer
- killTimer
- md5
- passwordHash
- passwordVerify
- pregFind
- pregMatch
- pregReplace
- removeDebugHook
- resetTimer
- setDevelopmentMode
- setFPSLimit
- setTimer
- ref
- deref
- sha256
- split
- teaDecode
- teaEncode
- toJSON
- tocolor
- getProcessMemoryStats
- utfChar
- utfCode
- utfLen
- utfSeek
- utfSub
- bitAnd
- bitNot
- bitOr
- bitXor
- bitTest
- bitLRotate
- bitRRotate
- bitLShift
- bitRShift
- bitArShift
- bitExtract
- bitReplace