de=กำ

This commit is contained in:
2024-01-24 21:27:06 +00:00
commit 1715d3538c
2 changed files with 62 additions and 0 deletions

31
toEnglish.js Normal file
View File

@@ -0,0 +1,31 @@
/**
{
"api":1,
"name":"to English",
"description":"I accidently typed English Qwerty text on Thai Kedmanee keyboard",
"author":"Tang Mo",
"icon":"translation",
"tags":"english,ำืเสรห้,เสรห้"
}
**/
// https://github.com/wrong-lang/spark/blob/main/src/layout.ahk
var kedmanee = 'ๅ/-ภถุึคตจขชๆไำพะัีรนยบลฃฟหกดเ้่าสวงผปแอิืทมใฝ+๑๒๓๔ู฿๕๖๗๘๙๐"ฎฑธํ๊ณฯญฐ,ฅฤฆฏโฌ็๋ษศซ.()ฉฮฺ์?ฒฬฦ';
var qwerty = `1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?`;
// Qwerty to Kedmanee
var source = kedmanee;
var dest = qwerty;
function main(state) {
try {
const charMap = new Map();
for (let i = 0; i < source.length; i++) {
charMap.set(source[i], dest[i]);
}
state.text = state.text.split('').map(char => charMap.get(char) || char).join('');
}
catch(error) {
state.postError("Something strange happened here...")
}
}