I want to know what will be the best way for a char-char conversion.
I will create some data for the conversion for example teh letter "A" will be converted to "C" and so on.
Shall I use a MySQL DB or files or what?
Note: The application will be a web app and most likely be running ASP or PHP.
EDIT:
I want to create a website or a desktop app that will allow user who work on PCs that only support one language to be able to use any other language something like a translator, yet it is not a translator.
For example, arabic users cannot use the AR keyboard due to system restrictions, I want to help them write in the language without installing the language pack. I`m facing this problem myself, and can`t install language pack without admin access.
I can`t provide output at the moment as the PC I`m using doesn`t support AR.
I guess you mean character / keyboard mapping (or an Input Method Editor as Ignacio Vazquez-Abrams said)...
In this case, create static hash maps / associative arrays that map keys to characters or strings.
That said, however, I think there are some keyboard mapping tools out there that hook into the operating system and can be customized to one's needs.
What about JavaScript?
Here's a simple code for converting the infamous YZ keys to ZY (QWERTY <-> QWERTZ).
<textarea id="txt"></textarea>
<script language="JavaScript" type="text/JavaScript">
document.getElementById("txt").onkeydown = InputKeyDown;
function InputKeyDown(event) {
var shift = event.shiftKey;
var keyCode = (event.which == null) ? event.keyCode : event.which;
//alert(String.fromCharCode(keyCode) + "\\n" + keyCode); return false;
switch (keyCode) {
case 89 /* Y */: InsertAtCursor(event.target, shift ? 'Z' : 'z'); return false;
case 90 /* Z */: InsertAtCursor(event.target, shift ? 'Y' : 'y'); return false;
default: return true;
}
}
</script>
I think you could start something with this. You can also use the event.ctrlKey
or event.altKey
flags for more complex languages.
精彩评论