In English, the genitive suffix ’s never changes its shape. For example, the genitive suffix ’s does not change its shape in the expressions Alice’s bicycle or Frank’s bicycle. In Turkish, however, the genitive suffix ’{n}{i}n changes its shape, where {n} is a variable depending on the last letter of the word to which the genitive suffix is added, and {i} is another variable depending on the vowel in the last syllable of the word to which the genitive suffix is added.
Here are some examples:
Ezgi’{n}{i}n -> Ezgi’nin [Ezgi's]
Sıtkı’{n}{i}n -> Sıtkı’nın [Sıtkı's]
Utku’{n}{i}n -> Utku’nun [Utku's]
Hüsnü’{n}{i}n -> Hüsnü’nün [Hüsnü’s]
Nefel’{n}{i}n -> Nefel’in [Nefel's]
Anıl’{n}{i}n -> Anıl’ın [Anıl's]
Ufuk’{n}{i}n -> Ufuk’un [Ufuk's]
Gönül’{n}{i}n -> Gönül’ün [Gönül's]
Imagine a \trgenitive command which is attached to a TURKISHWORD like so TURKISHWORD\trgenitive, and which prints TURKISKWORD’{n}{i}n, such that:
- if the last letter of TURKISHWORD is a consonant, then {n} is nothing/empty
- if the last letter of TURKISHWORD is a vowel, then {n} is n
- if the last vowel of TURKISHWORD is i or e, then {i} is i
- if the last vowel of TURKISHWORD is ı, then {i} is ı
- if the last vowel of TURKISHWORD is u, then {i} is u
- if the last vowel of TURKISHWORD is ü or ö, then {i} is ü.
Is it possible to define such a \trgenitive command?

TURKISHWORDis the argument:\trgenitive{TURKISHWORD}. Would that be a possibility? – Teepeemm Oct 15 '19 at 21:00pdflatex; perhaps some LuaTeX trickery can do. With\trgen{word}it can be done in XeLaTeX. – egreg Oct 15 '19 at 21:13