mirror of
https://github.com/penpot/penpot.git
synced 2025-06-11 11:21:39 +02:00
♻️ Refactor profile & language loading.
This commit is contained in:
parent
08dc1870bf
commit
406157c06c
7 changed files with 74 additions and 39 deletions
|
@ -8,11 +8,16 @@
|
|||
(ns uxbox.util.i18n
|
||||
"A i18n foundation."
|
||||
(:require [cuerdas.core :as str]
|
||||
[uxbox.util.storage :refer (storage)]))
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.util.storage :refer [storage]]))
|
||||
|
||||
(defonce locale (atom (get storage ::locale :en)))
|
||||
(defonce locale (atom (get storage ::locale cfg/default-language)))
|
||||
(defonce state (atom {}))
|
||||
|
||||
(defn set-default-locale!
|
||||
[]
|
||||
(set-current-locale! cfg/default-language))
|
||||
|
||||
(defn update-locales!
|
||||
[callback]
|
||||
(swap! state callback))
|
||||
|
|
|
@ -30,6 +30,10 @@
|
|||
(when (not= *target* "nodejs")
|
||||
(add-watch data :sub #(persist alias %4)))
|
||||
(reify
|
||||
Object
|
||||
(toString [_]
|
||||
(str "Storage" (pr-str @data)))
|
||||
|
||||
ICounted
|
||||
(-count [_]
|
||||
(count @data))
|
||||
|
@ -40,7 +44,7 @@
|
|||
|
||||
IReset
|
||||
(-reset! [self newval]
|
||||
(-reset! data newval))
|
||||
(reset! data newval))
|
||||
|
||||
ISwap
|
||||
(-swap! [self f]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue