0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 22:49:01 -05:00

🐛 Fix autodetect language issues

This commit is contained in:
Andrey Antukh 2022-10-20 00:06:50 +02:00 committed by Andrés Moya
parent 0548fdb43d
commit 2af28fef80
2 changed files with 12 additions and 11 deletions

View file

@ -17,6 +17,8 @@
- Fix path nodes panel. "To curve" and "To corner" icons are active if node is already curved/cornered [Taiga #4371](https://tree.taiga.io/project/penpot/issue/4371) - Fix path nodes panel. "To curve" and "To corner" icons are active if node is already curved/cornered [Taiga #4371](https://tree.taiga.io/project/penpot/issue/4371)
- Fix displaying comments settings are not applied via "Comments" menu drop-down on the top navbar on view mode [Taiga #4389](https://tree.taiga.io/project/penpot/issue/4389) - Fix displaying comments settings are not applied via "Comments" menu drop-down on the top navbar on view mode [Taiga #4389](https://tree.taiga.io/project/penpot/issue/4389)
- Fix bad behaviour on hovering and click nested artboards[Taiga #4018](https://tree.taiga.io/project/penpot/issue/4018) and [Taiga #4269](https://tree.taiga.io/project/penpot/us/4269) - Fix bad behaviour on hovering and click nested artboards[Taiga #4018](https://tree.taiga.io/project/penpot/issue/4018) and [Taiga #4269](https://tree.taiga.io/project/penpot/us/4269)
- Fix lang autodetect issue [Taiga #4277](https://tree.taiga.io/project/penpot/issue/4277)
## 1.16.0-beta ## 1.16.0-beta

View file

@ -68,19 +68,22 @@
(defonce locale (l/atom (or (get @storage ::locale) (defonce locale (l/atom (or (get @storage ::locale)
(autodetect)))) (autodetect))))
;; The translations `data` is a javascript object and should be treated
;; with `goog.object` namespace functions instead of a standart
;; clojure functions. This is for performance reasons because this
;; code is executed in the critical part (application bootstrap) and
;; used in many parts of the application.
(defn init! (defn init!
"Initialize the i18n module with translations.
The `data` is a javascript object for performance reasons. This code
is executed in the critical part (application bootstrap) and used in
many parts of the application."
[data] [data]
(set! translations data)) (set! translations data))
(defn set-locale! (defn set-locale!
[lname] [lname]
(if lname (if (or (nil? lname)
(str/empty? lname))
(let [lname (autodetect)]
(swap! storage dissoc ::locale)
(reset! locale lname))
(let [supported (into #{} (map :value supported-locales)) (let [supported (into #{} (map :value supported-locales))
lname (loop [locales (seq (parse-locale lname))] lname (loop [locales (seq (parse-locale lname))]
(if-let [locale (first locales)] (if-let [locale (first locales)]
@ -88,11 +91,7 @@
locale locale
(recur (rest locales))) (recur (rest locales)))
cfg/default-language))] cfg/default-language))]
(swap! storage assoc ::locale lname) (swap! storage assoc ::locale lname)
(reset! locale lname))
(let [lname (autodetect)]
(swap! storage dissoc ::locale)
(reset! locale lname)))) (reset! locale lname))))
(defn reset-locale (defn reset-locale