UNPKG

sinhala-unicode-coverter

Version:

A library to translate between sinhala unicode and legacy fonts

422 lines (421 loc) 18.9 kB
"use strict"; exports.__esModule = true; exports.unicodeToKaputa = void 0; exports.unicodeToKaputa = function (text) { text = text.replace(/;/g, "¶"); text = text.replace(/ත්‍රෛ/g, "@@wY"); text = text.replace(/ශෛ/g, "@@X"); text = text.replace(/චෛ/g, "@@c"); text = text.replace(/ජෛ/g, "@@j"); text = text.replace(/කෛ/g, "@@k"); text = text.replace(/මෛ/g, "@@m"); text = text.replace(/පෛ/g, "@@p"); text = text.replace(/දෛ/g, "@@q"); text = text.replace(/තෛ/g, "@@w"); text = text.replace(/නෛ/g, "@@n"); text = text.replace(/ධෛ/g, "@@{"); text = text.replace(/වෛ/g, "@@v"); text = text.replace(/ප්‍රෞ/g, "@pY_"); text = text.replace(/ෂ්‍යෝ/g, "@;&`~"); text = text.replace(/ඡ්‍යෝ/g, "@C&`~"); text = text.replace(/ඪ්‍යෝ/g, "@D&`~"); text = text.replace(/ඝ්‍යෝ/g, "@G&`~"); text = text.replace(/ඛ්‍යෝ/g, "@K&`~"); text = text.replace(/ළ්‍යෝ/g, "@L&`~"); text = text.replace(/ඵ්‍යෝ/g, "@P&`~"); text = text.replace(/ඨ්‍යෝ/g, "@T&`~"); text = text.replace(/ශ්‍යෝ/g, "@X&`~"); text = text.replace(/ක්‍ෂ්‍යෝ/g, "@]&`~"); text = text.replace(/බ්‍යෝ/g, "@b&`~"); text = text.replace(/ච්‍යෝ/g, "@c&`~"); text = text.replace(/ඩ්‍යෝ/g, "@d&`~"); text = text.replace(/ෆ්‍යෝ/g, "@f&`~"); text = text.replace(/ග්‍යෝ/g, "@g&`~"); text = text.replace(/ජ්‍යෝ/g, "@j&`~"); text = text.replace(/ක්‍යෝ/g, "@k&`~"); text = text.replace(/ල්‍යෝ/g, "@l&`~"); text = text.replace(/ම්‍යෝ/g, "@m&`~"); text = text.replace(/න්‍යෝ/g, "@n&`~"); text = text.replace(/ප්‍යෝ/g, "@p&`~"); text = text.replace(/ද්‍යෝ/g, "@q&`~"); text = text.replace(/ස්‍යෝ/g, "@s&`~"); text = text.replace(/ට්‍යෝ/g, "@t&`~"); text = text.replace(/ව්‍යෝ/g, "@v&`~"); text = text.replace(/ත්‍යෝ/g, "@w&`~"); text = text.replace(/භ්‍යෝ/g, "@x&`~"); text = text.replace(/ධ්‍යෝ/g, "@{&`~"); text = text.replace(/ථ්‍යෝ/g, "@}&`~"); text = text.replace(/ෂ්‍යො/g, "@;&`"); text = text.replace(/ශ්‍යො/g, "@X&`"); text = text.replace(/ඛ්‍යො/g, "@K&`"); text = text.replace(/ක්‍ෂ්‍යො/g, "@]&`"); text = text.replace(/බ්‍යො/g, "@b&`"); text = text.replace(/ව්‍යො/g, "@c&`"); text = text.replace(/ඩ්‍යො/g, "@d&`"); text = text.replace(/ෆ්‍යො/g, "@f&`"); text = text.replace(/ග්‍යො/g, "@g&`"); text = text.replace(/ජ්‍යො/g, "@j&`"); text = text.replace(/ක්‍යො/g, "@k&`"); text = text.replace(/ම්‍යො/g, "@m&`"); text = text.replace(/ප්‍යො/g, "@p&`"); text = text.replace(/ද්‍යො/g, "@q&`"); text = text.replace(/ස්‍යො/g, "@s&`"); text = text.replace(/ට්‍යො/g, "@t&`"); text = text.replace(/ව්‍යො/g, "@v&`"); text = text.replace(/ත්‍යො/g, "@w&`"); text = text.replace(/භ්‍යො/g, "@x&`"); text = text.replace(/ධ්‍යො/g, "@{&`"); text = text.replace(/ථ්‍යො/g, "@}&`"); text = text.replace(/ෂ්‍යෙ/g, "@;&"); text = text.replace(/ඡ්‍යෙ/g, "@C&"); text = text.replace(/ළ්‍යෙ/g, "@L&"); text = text.replace(/ණ්‍යෙ/g, "@N&"); text = text.replace(/ච්‍යෙ/g, "@c&"); text = text.replace(/ල්‍යෙ/g, "@l&"); text = text.replace(/න්‍යෙ/g, "@n&"); text = text.replace(/ශ්‍යෙ/g, "@X&"); text = text.replace(/ඛ්‍යෙ/g, "@K&"); text = text.replace(/ක්‍ෂ්‍යෙ/g, "@]&"); text = text.replace(/බ්‍යෙ/g, "@b&"); text = text.replace(/ඩ්‍යෙ/g, "@d&"); text = text.replace(/ෆ්‍යෙ/g, "@f&"); text = text.replace(/ග්‍යෙ/g, "@g&"); text = text.replace(/ජ්‍යෙ/g, "@j&"); text = text.replace(/ක්‍යෙ/g, "@k&"); text = text.replace(/ම්‍යෙ/g, "@m&"); text = text.replace(/ප්‍යෙ/g, "@p&"); text = text.replace(/ද්‍යෙ/g, "@q&"); text = text.replace(/ස්‍යෙ/g, "@s&"); text = text.replace(/ට්‍යෙ/g, "@t&"); text = text.replace(/ව්‍යෙ/g, "@v&"); text = text.replace(/ත්‍යෙ/g, "@w&"); text = text.replace(/භ්‍යෙ/g, "@x&"); text = text.replace(/ධ්‍යෙ/g, "@{&"); text = text.replace(/ථ්‍යෙ/g, "@}&"); text = text.replace(/ෂ්‍රෝ/g, "@;Y`~"); text = text.replace(/ඝ්‍රෝ/g, "@GY`~"); text = text.replace(/ශ්‍රෝ/g, "@XY`~"); text = text.replace(/ක්‍ෂ්‍රෝ/g, "@]Y`~"); text = text.replace(/බ්‍රෝ/g, "@bY`~"); text = text.replace(/ඩ්‍රෝ/g, "@dY`~"); text = text.replace(/ෆ්‍රෝ/g, "@fY`~"); text = text.replace(/ග්‍රෝ/g, "@gY`~"); text = text.replace(/ක්‍රෝ/g, "@kY`~"); text = text.replace(/ප්‍රෝ/g, "@pY`~"); text = text.replace(/ද්‍රෝ/g, "@qY`~"); text = text.replace(/ස්‍රෝ/g, "@sY`~"); text = text.replace(/ට්‍රෝ/g, "@tY`~"); text = text.replace(/ත්‍රෝ/g, "@wY`~"); text = text.replace(/ශ්‍රො/g, "@XY`"); text = text.replace(/ඩ්‍රො/g, "@dY`"); text = text.replace(/ෆ්‍රො/g, "@fY`"); text = text.replace(/ග්‍රො/g, "@gY`"); text = text.replace(/ක්‍රො/g, "@kY`"); text = text.replace(/ප්‍රො/g, "@pY`"); text = text.replace(/ද්‍රො/g, "@qY`"); text = text.replace(/ස්‍රො/g, "@sY`"); text = text.replace(/ට්‍රො/g, "@tY`"); text = text.replace(/ත්‍රො/g, "@wY`"); text = text.replace(/ශ්‍රේ/g, "@XY~"); text = text.replace(/බ්‍රේ/g, "@bY|"); text = text.replace(/ඩ්‍රේ/g, "@dY|"); text = text.replace(/ෆ්‍රේ/g, "@fY~"); text = text.replace(/ග්‍රේ/g, "@gY~"); text = text.replace(/ක්‍රේ/g, "@kY~"); text = text.replace(/ප්‍රේ/g, "@pY~"); text = text.replace(/ද්‍රේ/g, "@qY~"); text = text.replace(/ස්‍රේ/g, "@sY~"); text = text.replace(/ත්‍රේ/g, "@wY~"); text = text.replace(/ධ්‍රේ/g, "@{Y|"); text = text.replace(/ෂ්‍රෙ/g, "@;Y"); text = text.replace(/ශ්‍රෙ/g, "@XY"); text = text.replace(/බ්‍රෙ/g, "@bY"); text = text.replace(/ෆ්‍රෙ/g, "@fY"); text = text.replace(/ග්‍රෙ/g, "@gY"); text = text.replace(/ක්‍රෙ/g, "@kY"); text = text.replace(/ප්‍රෙ/g, "@pY"); text = text.replace(/ද්‍රෙ/g, "@qY"); text = text.replace(/ස්‍රෙ/g, "@sY"); text = text.replace(/ත්‍රෙ/g, "@wY"); text = text.replace(/භ්‍රෙ/g, "@xY"); text = text.replace(/ධ්‍රෙ/g, "@{Y"); text = text.replace(/ෂෞ/g, "@;_"); text = text.replace(/ඡෞ/g, "@C_"); text = text.replace(/ශෞ/g, "@X_"); text = text.replace(/බෞ/g, "@b_"); text = text.replace(/චෞ/g, "@c_"); text = text.replace(/ඩෞ/g, "@d_"); text = text.replace(/ෆෞ/g, "@f_"); text = text.replace(/ගෞ/g, "@g_"); text = text.replace(/ජෞ/g, "@j_"); text = text.replace(/කෞ/g, "@k_"); text = text.replace(/ලෞ/g, "@l_"); text = text.replace(/මෞ/g, "@m_"); text = text.replace(/නෞ/g, "@n_"); text = text.replace(/පෞ/g, "@p_"); text = text.replace(/දෞ/g, "@q_"); text = text.replace(/රෞ/g, "@r_"); text = text.replace(/සෞ/g, "@s_"); text = text.replace(/ටෞ/g, "@t_"); text = text.replace(/තෞ/g, "@w_"); text = text.replace(/භෞ/g, "@x_"); text = text.replace(/ඤෞ/g, "@z_"); text = text.replace(/ෂෝ/g, "@;`~"); text = text.replace(/ඹෝ/g, "@B`~"); text = text.replace(/ඡෝ/g, "@C`~"); text = text.replace(/ඪෝ/g, "@D`~"); text = text.replace(/ඝෝ/g, "@G`~"); text = text.replace(/ඛෝ/g, "@K`~"); text = text.replace(/ළෝ/g, "@L`~"); text = text.replace(/ඟෝ/g, "@M`~"); text = text.replace(/ණෝ/g, "@N`~"); text = text.replace(/ඵෝ/g, "@P`~"); text = text.replace(/ඨෝ/g, "@T`~"); text = text.replace(/ඬෝ/g, "@V`~"); text = text.replace(/ශෝ/g, "@X`~"); text = text.replace(/ඥෝ/g, "@Z`~"); text = text.replace(/ඳෝ/g, "@[`~"); text = text.replace(/ක්‍ෂෝ/g, "@]`~"); text = text.replace(/බෝ/g, "@b`~"); text = text.replace(/චෝ/g, "@c`~"); text = text.replace(/ඩෝ/g, "@d`~"); text = text.replace(/ෆෝ/g, "@f`~"); text = text.replace(/ගෝ/g, "@g`~"); text = text.replace(/හෝ/g, "@h`~"); text = text.replace(/ජෝ/g, "@j`~"); text = text.replace(/කෝ/g, "@k`~"); text = text.replace(/ලෝ/g, "@l`~"); text = text.replace(/මෝ/g, "@m`~"); text = text.replace(/නෝ/g, "@n`~"); text = text.replace(/පෝ/g, "@p`~"); text = text.replace(/දෝ/g, "@q`~"); text = text.replace(/රෝ/g, "@r`~"); text = text.replace(/සෝ/g, "@s`~"); text = text.replace(/ටෝ/g, "@t`~"); text = text.replace(/වෝ/g, "@v`~"); text = text.replace(/තෝ/g, "@w`~"); text = text.replace(/භෝ/g, "@x`~"); text = text.replace(/යෝ/g, "@y`~"); text = text.replace(/ඤෝ/g, "@z`~"); text = text.replace(/ධෝ/g, "@{`~"); text = text.replace(/ථෝ/g, "@}`~"); text = text.replace(/ෂො/g, "@;`"); text = text.replace(/ඹො/g, "@B`"); text = text.replace(/ඡො/g, "@C`"); text = text.replace(/ඪො/g, "@D`"); text = text.replace(/ඝො/g, "@G`"); text = text.replace(/ඛො/g, "@K`"); text = text.replace(/ළො/g, "@L`"); text = text.replace(/ඟො/g, "@M`"); text = text.replace(/ණො/g, "@N`"); text = text.replace(/ඵො/g, "@P`"); text = text.replace(/ඨො/g, "@T`"); text = text.replace(/ඬො/g, "@V`"); text = text.replace(/ශො/g, "@X`"); text = text.replace(/ඥො/g, "@Z`"); text = text.replace(/ඳො/g, "@[`"); text = text.replace(/ක්‍ෂො/g, "@]`"); text = text.replace(/බො/g, "@b`"); text = text.replace(/චො/g, "@c`"); text = text.replace(/ඩො/g, "@d`"); text = text.replace(/ෆො/g, "@f`"); text = text.replace(/ගො/g, "@g`"); text = text.replace(/හො/g, "@h`"); text = text.replace(/ජො/g, "@j`"); text = text.replace(/කො/g, "@k`"); text = text.replace(/ලො/g, "@l`"); text = text.replace(/මො/g, "@m`"); text = text.replace(/නො/g, "@n`"); text = text.replace(/පො/g, "@p`"); text = text.replace(/දො/g, "@q`"); text = text.replace(/රො/g, "@r`"); text = text.replace(/සො/g, "@s`"); text = text.replace(/ටො/g, "@t`"); text = text.replace(/වො/g, "@v`"); text = text.replace(/තො/g, "@w`"); text = text.replace(/භො/g, "@x`"); text = text.replace(/යො/g, "@y`"); text = text.replace(/ඤො/g, "@z`"); text = text.replace(/ධො/g, "@{`"); text = text.replace(/ථො/g, "@}`"); text = text.replace(/ෂේ/g, "@;~"); text = text.replace(/ඹේ/g, "@B|"); text = text.replace(/ඡේ/g, "@C~"); text = text.replace(/ඪේ/g, "@D~"); text = text.replace(/ඝේ/g, "@G~"); text = text.replace(/ඛේ/g, "@K|"); text = text.replace(/ළේ/g, "@L~"); text = text.replace(/ඟේ/g, "@M~"); text = text.replace(/ණේ/g, "@N~"); text = text.replace(/ඵේ/g, "@P~"); text = text.replace(/ඨේ/g, "@T~"); text = text.replace(/ඬේ/g, "@V|"); text = text.replace(/ශේ/g, "@X~"); text = text.replace(/ඥේ/g, "@Z~"); text = text.replace(/ඳේ/g, "@[~"); text = text.replace(/ක්‍ෂේ/g, "@]~"); text = text.replace(/බේ/g, "@b|"); text = text.replace(/චේ/g, "@c|"); text = text.replace(/ඩේ/g, "@d|"); text = text.replace(/ෆේ/g, "@f~"); text = text.replace(/ගේ/g, "@g~"); text = text.replace(/හේ/g, "@h~"); text = text.replace(/කේ/g, "@k~"); text = text.replace(/ලේ/g, "@l~"); text = text.replace(/මේ/g, "@m|"); text = text.replace(/නේ/g, "@n~"); text = text.replace(/පේ/g, "@p~"); text = text.replace(/දේ/g, "@q~"); text = text.replace(/රේ/g, "@r~"); text = text.replace(/සේ/g, "@s~"); text = text.replace(/ටේ/g, "@t|"); text = text.replace(/වේ/g, "@v|"); text = text.replace(/තේ/g, "@w~"); text = text.replace(/භේ/g, "@x~"); text = text.replace(/යේ/g, "@y~"); text = text.replace(/ඤේ/g, "@z~"); text = text.replace(/ජේ/g, "@j~"); text = text.replace(/ථේ/g, "@}~"); text = text.replace(/ධේ/g, "@{|"); text = text.replace(/ෂෙ/g, "@;"); text = text.replace(/ඹෙ/g, "@B"); text = text.replace(/ඓ/g, "@e"); text = text.replace(/ඡෙ/g, "@C"); text = text.replace(/ඪෙ/g, "@D"); text = text.replace(/ඝෙ/g, "@G"); text = text.replace(/ඛෙ/g, "@K"); text = text.replace(/ළෙ/g, "@L"); text = text.replace(/ඟෙ/g, "@M"); text = text.replace(/ණෙ/g, "@N"); text = text.replace(/ඵෙ/g, "@P"); text = text.replace(/ඨෙ/g, "@T"); text = text.replace(/ඬෙ/g, "@V"); text = text.replace(/ශෙ/g, "@X"); text = text.replace(/ඥෙ/g, "@Z"); text = text.replace(/ඳෙ/g, "@["); text = text.replace(/ක්‍ෂෙ/g, "@]"); text = text.replace(/බෙ/g, "@b"); text = text.replace(/චෙ/g, "@c"); text = text.replace(/ඩෙ/g, "@d"); text = text.replace(/ෆෙ/g, "@f"); text = text.replace(/ගෙ/g, "@g"); text = text.replace(/හෙ/g, "@h"); text = text.replace(/ජෙ/g, "@j"); text = text.replace(/කෙ/g, "@k"); text = text.replace(/ලෙ/g, "@l"); text = text.replace(/මෙ/g, "@m"); text = text.replace(/නෙ/g, "@n"); text = text.replace(/පෙ/g, "@p"); text = text.replace(/දෙ/g, "@q"); text = text.replace(/රෙ/g, "@r"); text = text.replace(/සෙ/g, "@s"); text = text.replace(/ටෙ/g, "@t"); text = text.replace(/වෙ/g, "@v"); text = text.replace(/තෙ/g, "@w"); text = text.replace(/භෙ/g, "@x"); text = text.replace(/යෙ/g, "@y"); text = text.replace(/ඤෙ/g, "@z"); text = text.replace(/ධෙ/g, "@{"); text = text.replace(/ථෙ/g, "@}"); text = text.replace(/්‍ය/g, "&"); text = text.replace(/්‍ර/g, "Y"); text = text.replace(/රු/g, "r#"); text = text.replace(/රූ/g, "r$"); text = text.replace(/ආ/g, "a`"); text = text.replace(/ඇ/g, "a#"); text = text.replace(/ඈ/g, "a$"); text = text.replace(/ඌ/g, "u_"); text = text.replace(/ඖ/g, "o_"); text = text.replace(/ඒ/g, "e~"); text = text.replace(/ඍ/g, "s^"); text = text.replace(/ඎ/g, " s^^"); text = text.replace(/ඓ/g, "@e"); text = text.replace(/ඕ/g, "o|"); text = text.replace(/බ්/g, "b|"); text = text.replace(/ච්/g, "c|"); text = text.replace(/ඩ්/g, "d|"); text = text.replace(/ම්/g, "m|"); text = text.replace(/ඕ/g, "o|"); text = text.replace(/ට්/g, "t|"); text = text.replace(/ව්/g, "v|"); text = text.replace(/ධ්/g, "{|"); text = text.replace(/ඛ්/g, "K||"); text = text.replace(/ඟු/g, "MO"); text = text.replace(/ශු/g, "XO"); text = text.replace(/ගු/g, "gO"); text = text.replace(/කු/g, "kO"); text = text.replace(/තු/g, "wO"); text = text.replace(/භු/g, "xO"); text = text.replace(/ඟූ/g, "MS"); text = text.replace(/ශූ/g, "XS"); text = text.replace(/ගූ/g, "gS"); text = text.replace(/කූ/g, "kS"); text = text.replace(/තූ/g, "wS"); text = text.replace(/භූ/g, "xS"); text = text.replace(/ළු/g, "U"); text = text.replace(/රැ/g, "rF"); text = text.replace(/රෑ/g, "rH"); text = text.replace(/එ/g, "e"); text = text.replace(/ෂ/g, ";"); text = text.replace(/ං/g, "A"); text = text.replace(/ඃ/g, ":"); text = text.replace(/ඹ/g, "B"); text = text.replace(/ඡ/g, "C"); text = text.replace(/ඪ/g, "D"); text = text.replace(/ඝ/g, "G"); text = text.replace(/ඊ/g, "I"); text = text.replace(/ඣ/g, "J"); text = text.replace(/ඛ/g, "K"); text = text.replace(/ළ/g, "L"); text = text.replace(/ඟ/g, "M"); text = text.replace(/ණ/g, "N"); text = text.replace(/ඵ/g, "P"); text = text.replace(/ඨ/g, "T"); text = text.replace(/ළු/g, "U"); text = text.replace(/ඬ/g, "V"); text = text.replace(/ශ/g, "X"); text = text.replace(/ඥ/g, "Z"); text = text.replace(/ඳ/g, "["); text = text.replace(/ක්‍ෂ/g, "]"); text = text.replace(/අ/g, "a"); text = text.replace(/බ/g, "b"); text = text.replace(/ච/g, "c"); text = text.replace(/ඩ/g, "d"); text = text.replace(/ඵ/g, "e"); text = text.replace(/ෆ/g, "f"); text = text.replace(/ග/g, "g"); text = text.replace(/හ/g, "h"); text = text.replace(/ඉ/g, "i"); text = text.replace(/ජ/g, "j"); text = text.replace(/ක/g, "k"); text = text.replace(/ල/g, "l"); text = text.replace(/ම/g, "m"); text = text.replace(/න/g, "n"); text = text.replace(/ඔ/g, "o"); text = text.replace(/ප/g, "p"); text = text.replace(/ද/g, "q"); text = text.replace(/ර/g, "r"); text = text.replace(/ස/g, "s"); text = text.replace(/ට/g, "t"); text = text.replace(/උ/g, "u"); text = text.replace(/ව/g, "v"); text = text.replace(/ත/g, "w"); text = text.replace(/භ/g, "x"); text = text.replace(/ය/g, "y"); text = text.replace(/ඤ/g, "z"); text = text.replace(/ධ/g, "{"); text = text.replace(/ථ/g, "}"); text = text.replace(/ෲ/g, "^^"); text = text.replace(/ැ/g, "#"); text = text.replace(/ෑ/g, "$"); text = text.replace(/ු/g, "E"); text = text.replace(/ූ/g, "R"); text = text.replace(/ි/g, "Q"); text = text.replace(/ී/g, "W"); text = text.replace(/ෘ/g, "\^"); text = text.replace(/ෟ/g, "_"); text = text.replace(/ා/g, "`"); text = text.replace(/්/g, "~"); text = text.replace(/¶/g, ":"); return text; };