GetLocalization: Difference between revisions
Jump to navigation
Jump to search
(Added an incomplete (where do I find them?) table of language codes to their language) |
(Should be complete now) |
||
Line 29: | Line 29: | ||
end) | end) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
This is | This is a list of all (probably all) the language codes used in MTA in a table with the full name of the language. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
langTable = { | langTable = { | ||
Line 49: | Line 49: | ||
["ro"] = "Romanian", | ["ro"] = "Romanian", | ||
["nb"] = "Norwegian", | ["nb"] = "Norwegian", | ||
[" | ["sv"] = "Swedish", | ||
["el"] = "Greek", | ["el"] = "Greek", | ||
["lt"] = "Lithuanian", | ["lt"] = "Lithuanian", | ||
Line 55: | Line 55: | ||
["vi"] = "Vietnamese", | ["vi"] = "Vietnamese", | ||
["bg"] = "Bulgarian", | ["bg"] = "Bulgarian", | ||
[" | ["cs"] = "Czech", | ||
["et"] = "Estonian", | |||
["ja"] = "Japanese", | |||
["lv"] = "Latvian", | |||
["mk"] = "Macedonian", | |||
["sk"] = "Slovak", | |||
["uk"] = "Ukranian", | |||
["zh_TW"] = "Taiwanese", | |||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 16:03, 14 June 2019
This function gets the player's localization setting as set in the MTA client.
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 simple Welcome message at the resource start (also when player joins the game if the resource is already running).
local msg = {cs = "Vítejte", fr = "Accueil", de = "Willkommen", pl = "Powitanie", hu = "Üdv"} 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)
This is a list of all (probably all) the language codes used in MTA in a table with the full name of the language.
langTable = { ["en_US"] = "English", ["ru"] = "Russian", ["ar"] = "Arabic", ["es"] = "Spanish", ["pt_BR"] = "Brazilian", ["hu"] = "Hungarian", ["de"] = "German", ["pl"] = "Polish", ["nl"] = "Dutch", ["tr"] = "Turkish", ["fr"] = "French", ["hr"] = "Croatian", ["sl"] = "Slovenian", ["it"] = "Italian", ["zh_CN"] = "Chinese", ["ro"] = "Romanian", ["nb"] = "Norwegian", ["sv"] = "Swedish", ["el"] = "Greek", ["lt"] = "Lithuanian", ["id"] = "Indonesian", ["vi"] = "Vietnamese", ["bg"] = "Bulgarian", ["cs"] = "Czech", ["et"] = "Estonian", ["ja"] = "Japanese", ["lv"] = "Latvian", ["mk"] = "Macedonian", ["sk"] = "Slovak", ["uk"] = "Ukranian", ["zh_TW"] = "Taiwanese", }
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