-
Notifications
You must be signed in to change notification settings - Fork 165
How to create a new input methods
Benny Lin edited this page Jul 30, 2023
·
8 revisions
- Clone the repository to your computer machine, if you haven't
- Create a new branch for your new input method
- You need to create a layout file in the "rules" subfolder, and you need to edit the "jquery.ime.inputmethods.js" in the "src" folder.
- Additionally you need to add a test in "jquery.ime.test.fixtures.js" in "test" folder
- Make sure it passed your test, (locally and) in the automatic test
- Publish the branch and ask for a Pull Request (PR)
- Wait until the automatic tests is passed, and the code is reviewed and merged, and the input method is shipped to the production server.
- Look for the subfolder with the language code of the language you wish to add.
- If there's already exist that language code, you just need to go to the next step
- If there's no folder with that language code, you need to create one.
- In that subfolder, you need to create a js file in the format of [languagecode]-[descriptor].js, where descriptor could be anything, like Tamil language has several input methods, called "ta-99.js", "ta-bamini.js", "ta-inscript.js", "ta-inscript2.js", "ta-transliteration.js" (in the folder "rules/ta/"). Other descriptors like -kbd, -keyboard, -normforms, -phonetic, -tilde, are also common.
- See the Technical-Specification on how this file works. Otherwise, you could just copy from other language input methods, and adapt it.
- Edit the "jquery.ime.inputmethods.js" in the "src" folder
- You need to add your new input method under the alphabetically sorted language code, Twice.
- First you need to register the input method
- Then if the language is new, you need to register the language and the available input method. For example here I registered a new "btm" and "btm-keyboard"
- Otherwise, if it's not a new language for the jquery.ime (other developer has developed input methods for that language before), then just add your new input method in the list. For example, here I added "jv-keyboard" among other jv input methods that's already available
- Add a new test in "jquery.ime.test.fixtures.js" in "test" folder
- It's up to you how rigorous the test is, but ideally it should test for all possible input, and also for fringe cases.
- Everytime you update your input method, you should update the test to (and make sure it pass the previous tests as well).
- Once you upload it, it will do automatic tests, and if it fail, the code won't get reviewed until you fix the code again.
- Install Python 3
- Run "python3 -m http.server". It will create a little web server. It's supposed to show you a URL, probably something like http://0.0.0.0:8000/. Open a private window on your browser, go to that URL, and go to the examples directory.
- (if you're on Windows and your jquery.ime installation is in "d:\Documents\GitHub\jquery.ime\" for example, you should run the code in that folder)
- (if "python3 -m http.server" doesn't work, try "python -m http.server")
- (if http://0.0.0.0:8000/ doesn't work, try http://127.0.0.1:8000/)
- (It's important to use a private window, because you are going to change the code all the time, and since this web browser is super-basic, the browser is going to be stupid about caching, and load the old version.)
- Test / debugging locally at http://127.0.0.1:8000/examples/