Skip to content

How to add support for a new input language (Turkish) #2

Description

@Ubimos

I am attempting to add support for a new input language Turkish to the project.

To achieve this, I modified the existing mapping structure (demonstrated below using ru.toml as a base) to include target mappings for Turkish characters (such as ç, ğ, ı, i, ö, ş, ü).

The Problem:

While updating the mappings is straightforward, I am stuck on how the application handles the source input language. It appears that the English keyboard layout/input language is hardcoded into the project's logic.

I did some digging and noticed that during registration, the project interfaces with the Windows Registry using definitions to LANG_ENGLISH and SUB_LANG_EN. I attempted to modify these values to their Turkish counterparts in my local environment, but it didn't change the behavior.

Because I don't have extensive experience with C++ ,I'm having trouble tracking down exactly where the input initialization and language binding happen in the source code.

language = 'ru'
name = 'Russian'

variants.default.display = 'default'
variants.'translit-ru'.display = 'translit.ru'

[[mappings]]

'А' = 'A'                                               #  1
'а' = 'a'
'Б' = 'B'                                               #  2
'б' = 'b'
'В' = 'V'                                               #  3
'в' = 'v'
'Г' = 'G'                                               #  4
'г' = "g"
'Д' = "D"                                               #  5
'д' = "d"
'Е' = "E"                                               #  6
'е' = "e"
'Ё' = [["Jo", "JO"], ["Yo", "YO"], "Ö", "Ë"]            #  7
'ё' = ["jo", "yo", "ö", "ë"]
'Ж' = [["Zh", "ZH"], "Ğ"]                               #  8 (Turkish: Ğ)
'ж' = ["zh", "ğ"]

[[mappings]]

'З' = "Z"                                               #  9
'з' = "z"
'И' = ["İ"]                                        # 10 (Turkish: İ dotted I)
'и' = "i"
'Й' = "J"                                               # 11
'й' = "j"
'К' = "K"                                               # 12
'к' = "k"
'Л' = "L"                                               # 13
'л' = "l"
'М' = "M"                                               # 14
'м' = "m"
'Н' = "N"                                               # 15
'н' = "n"
'О' = "O"                                               # 16
'о' = "o"

[[mappings]]

'П' = "P"                                               # 17
'п' = "p"
'Р' = "R"                                               # 18
'р' = "r"
'С' = "S"                                               # 19
'с' = "s"
'Т' = "T"                                               # 20
'т' = "t"
'У' = "U"                                               # 21
'у' = "u"
'Ф' = "F"                                               # 22
'ф' = "f"
'Х' = ["H", "X"]                                        # 23
'х' = ["h", "x"]
'Ц' = "C"                                               # 24
'ц' = "c"

[[mappings]]

'Ч' = [["Ch", "CH"], "Ç"]                               # 25 (Turkish: Ç)
'ч' = ["ch", "ç"]
'Ш' = [["Sh", "SH"], "Ş"]                               # 26 (Turkish: Ş)
'ш' = ["sh", "ş"]
'Щ' = ["W", ["Shh", "SHh", "SHH"]]                      # 27
'щ' = ["w", "shh"]

'Ъ'.default = [["Qq", "QQ"]]                            # 28
'Ъ'.'translit-ru' = "##"
'ъ'.default = "qq"
'ъ'.'translit-ru' = ["#", "tvz"]

'Ы' = ["Y", "I"]                                  		# 29 (Turkish: İ capital dotted)
'ы' = ["y", "ı"]                                        #    (Turkish: ı dotless i)

'Ь'.default = "Q"                                       # 30
'Ь'.'translit-ru' = "''" 
'ь'.default = "q"
'ь'.'translit-ru' = ["'", "mjz"]

'Э' = [["Je", "JE"], "Ä"]                               # 31
'э' = ["je", "ä"]
'Ю' = [["Ju", "JU"], ["Yu", "YU"], "Ü"]                 # 32
'ю' = ["ju", "yu", "ü"]

'Я'.default = [["Ja", "JA"], ["Ya", "YA"]]              # 33
'Я'.'translit-ru' = [["Ja", "JA"], ["Ya", "YA"], "Q"]
'я'.default = ["ja", "ya"]
'я'.'translit-ru' = ["ja", "ya", "q"]

[footer]

content = """
❗️To enter combinations such as <code>сх</code> or <code>шх</code> press <code>ESC</code>
after the first letter to stop recognition. That is <code>s\u00A0ESC\u00A0h</code> will
produce <code>сх</code> and <code>sh\u00A0ESC\u00A0h</code> will produce <code>шх</code>.
"""

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions