Commit 440af5c3 authored by Siong-Ui Te's avatar Siong-Ui Te

dic: Romanized Pali to Thai script

parent 3370517a
......@@ -13,16 +13,44 @@ addons:
- make
- git
- gettext
install:
- cd tipitaka/
- make install
script:
- make make-sutta
deploy:
- provider: pages
repo: siongui/tipitaka.sutta.org
skip_cleanup: true
github_token: $GITHUB_TOKEN
local_dir: tipitaka/website
on:
branch: master
# https://docs.travis-ci.com/user/build-matrix/
jobs:
include:
# for dictionary.online-dhamma.net
- env: TARGET_WEBSITE=dhamma
install:
- cd dictionary/
- make install
script:
- make make-dhamma
after_success:
- make custom_dhamma_deploy
# for dictionary.sutta.org
- env: TARGET_WEBSITE=sutta
install:
- cd dictionary/
- make install
script:
- make make-sutta
after_success:
- make custom_sutta_deploy
# dpl v2 (not working for lots of symlinks)
#deploy:
# - provider: pages:git
# repo: siongui/dictionary.sutta.org
# keep_history: false
# token: $GITHUB_TOKEN
# local_dir: website
# on:
# branch: master
# edge: true
# verbose: true
# dpl v1 (not working for lots of symlinks)
#deploy:
# - provider: pages
# repo: siongui/dictionary.sutta.org
# skip_cleanup: true
# github_token: $GITHUB_TOKEN
# local_dir: website
# on:
# branch: master
......@@ -269,6 +269,7 @@ lib_pali:
go get -u github.com/siongui/gopalilib/libfrontend/velthuis
go get -u github.com/siongui/gopalilib/libfrontend/setting
go get -u github.com/siongui/gopalilib/libfrontend
go get -u github.com/siongui/pali-transliteration
lib_gtmpl:
@echo "\033[92mInstalling Go html/template with gettext support ...\033[0m"
......
......@@ -2,6 +2,7 @@ package main
import (
"strings"
"time"
. "github.com/siongui/godom"
"github.com/siongui/gopalilib/lib/dicmgr"
......@@ -9,6 +10,7 @@ import (
"github.com/siongui/gopalilib/libfrontend/setting"
"github.com/siongui/gopalilib/libfrontend/velthuis"
sg "github.com/siongui/gopherjs-input-suggest"
palitrans "github.com/siongui/pali-transliteration"
)
var mainContent *Object
......@@ -19,6 +21,12 @@ func handleEnterEvent(input *Object) {
go httpGetWordJson(w, true)
}
func toThai(input *Object) {
w := strings.ToLower(strings.TrimSpace(input.Value()))
t := palitrans.RomanToThai(w)
Document.GetElementById("r2t").SetInnerHTML(t)
}
func handleInputKeyUp(e Event) {
switch keycode := e.KeyCode(); keycode {
case 13:
......@@ -108,4 +116,15 @@ func main() {
}
*/
})
// Romanized Pali to Thai
ticker := time.NewTicker(500 * time.Millisecond)
go func() {
for {
select {
case <-ticker.C:
toThai(input)
}
}
}()
}
......@@ -47,6 +47,8 @@ https://stackoverflow.com/questions/56611772/how-to-shorten-bulma-input
<button class="button is-rounded is-info is-light is-small my-1" id="toggle-keypad"><span>Show Keypad</span><span class="is-hidden">Hide Keypad</span></button>
<button class="button is-rounded is-info is-light is-small my-1" id="toggle-type-hint"><span>Show Pāli Type Hint on Top</span><span class="is-hidden">Hide Pāli Type Hint on Top</span></button>
<div class="content mb-0">Thai: <span id="r2t"></span> (<a href="mailto:[email protected]">report bug</a> if wrong)</div>
<div class="field">
<div class="control">
<input id="word" class="input" type="text"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment