Skip to content

Commit

Permalink
Ability to setup keybinds on russian keylayout
Browse files Browse the repository at this point in the history
  • Loading branch information
Vallat authored and Bizzonium committed Nov 18, 2021
1 parent 683bede commit 8b85083
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions code/__HELPERS/text.dm
Original file line number Diff line number Diff line change
Expand Up @@ -373,3 +373,16 @@ GLOBAL_LIST_INIT(binary, list("0","1"))
return json_decode(data)
catch
return

GLOBAL_LIST_INIT(ru_key_to_en_key, list("й" = "q", "ц" = "w", "у" = "e", "к" = "r", "е" = "t", "н" = "y", "г" = "u", "ш" = "i", "щ" = "o", "з" = "p", "х" = "\[", "ъ" = "]",
"ф" = "a", "ы" = "s", "в" = "d", "а" = "f", "п" = "g", "р" = "h", "о" = "j", "л" = "k", "д" = "l", "ж" = ";", "э" = "'",
"я" = "z", "ч" = "x", "с" = "c", "м" = "v", "и" = "b", "т" = "n", "ь" = "m", "б" = ",", "ю" = "."))

/proc/convert_ru_key_to_en_key(var/_key)
var/new_key = lowertext(_key)
new_key = GLOB.ru_key_to_en_key[new_key]
if(!new_key)
return _key
return uppertext(new_key)


2 changes: 1 addition & 1 deletion code/modules/client/preferences_ui.dm
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@
if(!params["key"])
return
var/mods = params["key_mods"]
var/full_key = params["key"]
var/full_key = convert_ru_key_to_en_key(params["key"])
var/Altmod = ("ALT" in mods) ? "Alt" : ""
var/Ctrlmod = ("CONTROL" in mods) ? "Ctrl" : ""
var/Shiftmod = ("SHIFT" in mods) ? "Shift" : ""
Expand Down

0 comments on commit 8b85083

Please sign in to comment.