mirror of
https://github.com/logseq/logseq.git
synced 2026-05-03 02:16:30 +00:00
Simplify fn translations in light of #10868
- Reverted overly complex fn translations from #10810 - Updated guidelines so it's clear that fn translations need to remain simple. They shouldn't be so complex that they fail for edge cases - Updated catch so we are aware when translations fail
This commit is contained in:
committed by
Tienson Qin
parent
c4341c1884
commit
283d084de2
@@ -4,7 +4,8 @@
|
||||
throughout the application."
|
||||
(:require [frontend.dicts :as dicts]
|
||||
[tongue.core :as tongue]
|
||||
[frontend.state :as state]))
|
||||
[frontend.state :as state]
|
||||
[lambdaisland.glogi :as log]))
|
||||
|
||||
(def dicts (merge dicts/dicts {:tongue/fallback :en}))
|
||||
|
||||
@@ -17,8 +18,13 @@
|
||||
(try
|
||||
(apply translate preferred-language args)
|
||||
(catch :default e
|
||||
(js/console.error "Translating dict" e)
|
||||
(apply translate :en args)))))
|
||||
(log/error :failed-translation {:arguments args
|
||||
:lang preferred-language})
|
||||
(apply translate :en args)
|
||||
(state/pub-event! [:capture-error {:error e
|
||||
:payload {:type :failed-translation
|
||||
:arguments args
|
||||
:lang preferred-language}}])))))
|
||||
|
||||
(defn- fetch-local-language []
|
||||
(.. js/window -navigator -language))
|
||||
|
||||
Reference in New Issue
Block a user