|
|
| Line 160: |
Line 160: |
| end | | end |
| end) | | end) |
|
| |
| KEYBINDS = {
| |
| -- Movement
| |
| MoveForward = "'''Move Forward button'''",
| |
| MoveBackwards = "'''Move Backward button'''",
| |
| MoveLeft = "'''Move Left button'''",
| |
| MoveRight = "'''Move Right button'''",
| |
| Mantle = "'''Jump button'''",
| |
| Zipline = "'''Zipline button'''",
| |
| Roll = "'''Dash button'''",
| |
| Crouch = "'''Crouch button'''",
| |
| MoveDown = "'''Fly Down button'''",
| |
| MoveUp = "'''Fly Up button'''",
| |
|
| |
| -- Combat
| |
| Attack = "'''Fire button'''",
| |
| ADS = "'''Alt-Fire button'''",
| |
| Reload = "'''Reload button'''",
| |
| AbilityMelee = "'''Melee button'''",
| |
| HeldItem = "'''Melee Parry/Throw Held Item button'''",
| |
|
| |
| -- Abilities
| |
| Ability1 = "'''Ability 1 button'''",
| |
| Ability2 = "'''Ability 2 button'''",
| |
| Ability3 = "'''Ability 3 button'''",
| |
| Ability4 = "'''Ability 4 button'''",
| |
| AltCast = "'''Alternate Cast'''",
| |
|
| |
| -- UI & Menus
| |
| OpenHeroSheet = "'''Open Shop button'''",
| |
| PurchaseQuickbuy = "'''Purchase Quickbuy button'''",
| |
| Scoreboard = "'''Scoreboard button'''",
| |
| OpenMainMenu = "'''Open Main Menu button'''",
| |
|
| |
| -- Communication
| |
| PushToTalk = "'''Voice Chat button'''",
| |
|
| |
| -- Misc & Hideout
| |
| Pause = "'''Pause button'''",
| |
| ReplayDeath = "'''Replay Death button'''",
| |
| HideoutUse = "'''Interact with an object in the Hideout button'''",
| |
| HideoutCancelMatchmaking = "'''Cancel Matchmaking button'''",
| |
| }
| |
| | | |
| -- Process citadel_binding/citadel_keybind tags to replace with keybind strings/templates | | -- Process citadel_binding/citadel_keybind tags to replace with keybind strings/templates |
| text = text:gsub("{g:citadel_binding:'(.-)'}", function(key) | | text = text:gsub("{g:citadel_binding:'(.-)'}", function(key) |
| local replacement = KEYBINDS[key]
| | -- convert key to lowercase |
| if replacement then | | local lower_key = key:lower() |
| local lang_code = p.get_lang_code()
| | -- look up key with Module:Lang |
| | local translated = frame:preprocess('{{#invoke:Lang|get_string|citadel_keybind_'.. lower_key ..'}}') |
| | | |
| -- strip bold markup before dictionary lookup
| | if translated ~= nil and translated ~= '' then |
| local raw = replacement:gsub("^'''", ""):gsub("'''$", "")
| | return "'''" .. translated .. "'''" |
|
| |
| local translated = dictionary_module.translate(raw, lang_code)
| |
|
| |
| if translated ~= nil and translated ~= '' then
| |
| return "'''" .. translated .. "'''"
| |
| else
| |
| return replacement
| |
| end
| |
| else | | else |
| return '<span style="color:red;font-weight:bold;border-bottom:1px dotted red;" title="Missing keybind - Add \''..key..'\' to local replacements in [Module:Lang]">['..key..']</span>'
| | return '<span style="color:red;font-weight:bold;border-bottom:1px dotted red;" title="Missing keybind - Add an exception for \''..key..'\' in [Module:Lang]">['..key..']</span>' |
| end | | end |
| end) | | end) |