Commit 3370517a authored by Siong-Ui Te's avatar Siong-Ui Te

move common frontend code to libfrontend

parent 7ce99de2
......@@ -13,44 +13,16 @@ addons:
- make
- git
- gettext
# 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
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
......@@ -101,7 +101,6 @@ install: lib_pali lib_gtmpl lib_godom lib_gopherjs lib_goef
lib_pali:
@echo "\033[92mInstalling common lib used in this project ...\033[0m"
go get -u github.com/siongui/gopalilib/dicutil
go get -u github.com/siongui/gopalilib/lib/jsgettext
go get -u github.com/siongui/gopalilib/lib/tipitaka
go get -u github.com/siongui/gopalilib/libfrontend
go get -u github.com/siongui/gopalilib/libfrontend/everyword
......
......@@ -5,7 +5,6 @@ import (
. "github.com/siongui/godom"
"github.com/siongui/gopalilib/lib"
"github.com/siongui/gopalilib/lib/jsgettext"
"github.com/siongui/gopalilib/libfrontend"
"github.com/siongui/gopalilib/libfrontend/everyword"
"github.com/siongui/gopalilib/libfrontend/setting"
......@@ -14,17 +13,6 @@ import (
"github.com/siongui/gopalilib/libfrontend/xslt"
)
func getFinalShowLocale() string {
var supportedLocales = []string{"en_US", "zh_TW", "vi_VN", "fr_FR"}
var navigatorLanguages = Window.Navigator().Languages()
// show language according to site url and NavigatorLanguages API
locale := Document.GetElementById("site-info").Dataset().Get("locale").String()
if locale == "" {
return jsgettext.DetermineLocaleByNavigatorLanguages(navigatorLanguages, supportedLocales)
}
return locale
}
func xmlAction(t lib.Tree) {
// FIXME: show loading not working on Chromium
ShowIsLoadingXML(t.Text)
......@@ -48,17 +36,8 @@ func xmlAction(t lib.Tree) {
ToggleMobileTreeview()
}
func TranslateDocument(locale string) {
elms := Document.QuerySelectorAll("[data-default-string]")
for _, elm := range elms {
str := elm.Get("dataset").Get("defaultString").String()
elm.Set("textContent", jsgettext.Gettext(locale, str))
}
}
func main() {
//println(getFinalShowLocale())
TranslateDocument(getFinalShowLocale())
libfrontend.TranslateDocument(libfrontend.GetFinalShowLocale())
b, _ := ReadFile("tpktoc.json")
//println(string(b))
......
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