Skip to content

Commit

Permalink
fix: typo
Browse files Browse the repository at this point in the history
  • Loading branch information
tiensonqin committed May 19, 2021
1 parent 43a4a3a commit 75c369e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/main/frontend/components/settings.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
"NOW/LATER"
"TODO/DOING")])]]]]

(toggle "prefered_outdenting"
(toggle "preferred_outdenting"
(ui/tippy {:html (outdenting-hint)
:interactive true
:theme "customized"}
Expand Down
18 changes: 9 additions & 9 deletions src/main/frontend/context/i18n.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@
[frontend.state :as state]))

;; TODO
;; - [x] Get the prefered language from state
;; - [x] Update the prefered language
;; - [x] Create t functiona which takes a keyword and returns text with the current prefered language
;; - [x] Add fetch for local browser prefered language if user has set it already
;; - [ ] Fetch prefered language from backend if user is logged in
;; - [x] Get the preferred language from state
;; - [x] Update the preferred language
;; - [x] Create t functiona which takes a keyword and returns text with the current preferred language
;; - [x] Add fetch for local browser preferred language if user has set it already
;; - [ ] Fetch preferred language from backend if user is logged in

(defn fetch-local-language []
(.. js/window -navigator -language))

(rum/defcontext *tongue-context*)

(rum/defc tongue-provider [children]
(let [prefered-language (keyword (state/sub :preferred-language))
(let [preferred-language (keyword (state/sub :preferred-language))
set-preferred-language state/set-preferred-language!
all-dicts (deep-merge dicts/dicts shortcut-dict/dict)
t (partial (dicts/translate all-dicts) prefered-language)]
(if (nil? prefered-language)
t (partial (dicts/translate all-dicts) preferred-language)]
(if (nil? preferred-language)
(set-preferred-language (fetch-local-language))
:ok)
(rum/bind-context [*tongue-context* [t prefered-language set-preferred-language]]
(rum/bind-context [*tongue-context* [t preferred-language set-preferred-language]]
children)))

(rum/defc use-tongue []
Expand Down

0 comments on commit 75c369e

Please sign in to comment.