local p = {}

function p.convert(frame)
    local input = frame.args[1]
    local lastChar = mw.ustring.sub(input, -1)
    
    -- Define the mappings of last letters to their "ඒ" forms
    local suffixMap = {
        ['ක'] = 'කේ',
        ['ග'] = 'ගේ',
        ['ච'] = 'චේ',
        ['ජ'] = 'ජේ',
        ['ඛ'] = 'ඛේ',
        ['ය'] = 'යේ',
        ['ව'] = 'වේ',
        ['ම'] = 'මේ',
        ['ර'] = 'රේ',
        ['ද'] = 'දේ',
        ['බ'] = 'බේ',
        ['ප'] = 'පේ',
        ['න'] = 'නේ',
        ['ඝ'] = 'ඝේ',
        ['ඟ'] = 'ඟේ',
        ['ඡ'] = 'ඡේ',
        ['ඣ'] = 'ඣේ',
        ['ඥ'] = 'ඥේ',
        ['ඤ'] = 'ඤේ',
        ['ට'] = 'ටේ',
        ['ඨ'] = 'ඨේ',
        ['ඩ'] = 'ඩේ',
        ['ඪ'] = 'ඪේ',
        ['ණ'] = 'ණේ',
        ['ඬ'] = 'ඬේ',
        ['ත'] = 'තේ',
        ['ථ'] = 'ථේ',
        ['ධ'] = 'ධේ',
        ['ඳ'] = 'ඳේ',
        ['ඵ'] = 'ඵේ',
        ['භ'] = 'භේ',
        ['ඹ'] = 'ඹේ',
        ['ල'] = 'ලේ',
        ['ශ'] = 'ශේ',
        ['ෂ'] = 'ෂේ',
        ['ස'] = 'සේ',
        ['හ'] = 'හේ',
        ['ළ'] = 'ළේ',
        ['ෆ'] = 'ෆේ',
        -- Add other mappings as needed
    }
    
    -- Find the suffix based on the last character
    local suffix = suffixMap[lastChar]
    
    if suffix then
        -- Replace the last character with its "ඒ" version
        return mw.ustring.sub(input, 1, -2) .. suffix
    else
        -- If there's no matching suffix, add "හි" as a default
        return input .. ' හි'
    end
end
return p
"https://si.wikipedia.org/w/index.php?title=Module:ConvertToAe&oldid=720490" වෙතින් සම්ප්‍රවේශනය කෙරිණි