Add custom linter for i18n/label translation keywords (#17610)

This commit adds a custom linter to verify i18n/label is called with a qualified
keyword, like :t/foo. More sophisticated linters are possible too.

We also set the stage for other developers to consider more lint automation
instead of manually reviewing conventions in PRs.

If you want to understand how to write custom linters, check out
https://github.com/clj-kondo/clj-kondo/blob/master/doc/hooks.md. You can fire
the Clojure JVM REPL in status-mobile and play with the clj-kondo hook too, it
works beautifully.

Why do we care? By making sure all translation keywords are qualified with "t",
it is trivial to grep or replace them because they're unique in the repo, and
can't be confused with other words if you search by ":t/<something>".

Note: It's a best practice to commit clj-kondo configuration from external
libraries in the .clj-kondo directory. The directory .clj-kondo/babashka is
auto-generated, that's why it was added.
This commit is contained in:
Icaro Motta 2023-10-11 21:53:34 +00:00 committed by GitHub
parent 54e347eaea
commit 7f960f9be5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 724 additions and 465 deletions

View File

@ -0,0 +1 @@
{:lint-as {babashka.fs/with-temp-dir clojure.core/let}}

View File

@ -0,0 +1 @@
{:hooks {:macroexpand {sci.core/copy-ns sci.core/copy-ns}}}

View File

@ -0,0 +1,9 @@
(ns sci.core)
(defmacro copy-ns
([ns-sym sci-ns]
`(copy-ns ~ns-sym ~sci-ns nil))
([ns-sym sci-ns opts]
`[(quote ~ns-sym)
~sci-ns
(quote ~opts)]))

View File

@ -1,4 +1,5 @@
{:lint-as {status-im.utils.views/defview clojure.core/defn {:config-paths ["status-im"]
:lint-as {status-im.utils.views/defview clojure.core/defn
status-im.utils.views/letsubs clojure.core/let status-im.utils.views/letsubs clojure.core/let
reagent.core/with-let clojure.core/let reagent.core/with-let clojure.core/let
status-im.utils.fx/defn clj-kondo.lint-as/def-catch-all status-im.utils.fx/defn clj-kondo.lint-as/def-catch-all

View File

@ -0,0 +1,2 @@
{:hooks {:analyze-call {utils.i18n/label hooks.core/i18n-label}}
:linters {:status-im.linter/invalid-translation-keyword {:level :error}}}

View File

@ -0,0 +1,19 @@
(ns hooks.core
(:require [clj-kondo.hooks-api :as api]))
(defn i18n-label
"Verify call to `i18n/label` pass the translation keyword qualified with `t`."
[{:keys [node]}]
(let [[_ translation-key-node & _] (:children node)]
(when (and (api/keyword-node? translation-key-node)
(not= "t" (-> translation-key-node api/sexpr namespace)))
(api/reg-finding! (assoc (meta translation-key-node)
:message "Translation keyword should be qualified with \"t\""
:type :status-im.linter/invalid-translation-keyword)))))
(comment
;; Valid
(i18n-label {:node (api/parse-string "(i18n/label :t/foo)")})
;; Invalid
(i18n-label {:node (api/parse-string "(i18n/label :foo)")}))

File diff suppressed because it is too large Load Diff

View File

@ -1,103 +1,120 @@
args4j/args4j/2.33/args4j-2.33.jar
babashka/fs/0.2.16/fs-0.2.16.jar
bidi/bidi/2.1.6/bidi-2.1.6.jar bidi/bidi/2.1.6/bidi-2.1.6.jar
binaryage/env-config/0.2.2/env-config-0.2.2.jar binaryage/env-config/0.2.2/env-config-0.2.2.jar
binaryage/oops/0.7.2/oops-0.7.2.jar binaryage/oops/0.7.2/oops-0.7.2.jar
borkdude/edamame/1.1.17/edamame-1.1.17.jar
borkdude/sci.impl.reflector/0.0.1/sci.impl.reflector-0.0.1.jar
camel-snake-kebab/camel-snake-kebab/0.4.3/camel-snake-kebab-0.4.3.jar camel-snake-kebab/camel-snake-kebab/0.4.3/camel-snake-kebab-0.4.3.jar
cider/cider-nrepl/0.29.0/cider-nrepl-0.29.0.jar cheshire/cheshire/5.11.0/cheshire-5.11.0.jar
cider/piggieback/0.5.2/piggieback-0.5.2.jar cider/cider-nrepl/0.25.3/cider-nrepl-0.25.3.jar
cider/piggieback/0.4.1/piggieback-0.4.1.jar
clj-kondo/clj-kondo/2023.09.07/clj-kondo-2023.09.07.jar
cljs-bean/cljs-bean/1.3.0/cljs-bean-1.3.0.jar cljs-bean/cljs-bean/1.3.0/cljs-bean-1.3.0.jar
clout/clout/2.1.2/clout-2.1.2.jar clout/clout/2.1.2/clout-2.1.2.jar
com/andrewmcveigh/cljs-time/0.5.2/cljs-time-0.5.2.jar com/andrewmcveigh/cljs-time/0.5.2/cljs-time-0.5.2.jar
com/bhauman/cljs-test-display/0.1.1/cljs-test-display-0.1.1.jar com/bhauman/cljs-test-display/0.1.1/cljs-test-display-0.1.1.jar
com/cognitect/transit-clj/1.0.324/transit-clj-1.0.324.jar com/cognitect/transit-clj/1.0.329/transit-clj-1.0.329.jar
com/cognitect/transit-cljs/0.8.248/transit-cljs-0.8.248.jar com/cognitect/transit-cljs/0.8.248/transit-cljs-0.8.248.jar
com/cognitect/transit-java/1.0.343/transit-java-1.0.343.jar com/cognitect/transit-java/1.0.362/transit-java-1.0.362.jar
com/cognitect/transit-js/0.8.846/transit-js-0.8.846.jar com/cognitect/transit-js/0.8.846/transit-js-0.8.846.jar
com/fasterxml/jackson/core/jackson-core/2.8.7/jackson-core-2.8.7.jar com/fasterxml/jackson/core/jackson-core/2.13.3/jackson-core-2.13.3.jar
com/fasterxml/jackson/dataformat/jackson-dataformat-cbor/2.13.3/jackson-dataformat-cbor-2.13.3.jar
com/fasterxml/jackson/dataformat/jackson-dataformat-smile/2.13.3/jackson-dataformat-smile-2.13.3.jar
com/github/javaparser/javaparser-core/3.25.3/javaparser-core-3.25.3.jar
com/google/auto/value/auto-value-annotations/1.6/auto-value-annotations-1.6.jar
com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar
com/google/code/gson/gson/2.9.1/gson-2.9.1.jar
com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar
com/google/javascript/closure-compiler-unshaded/v20210302/closure-compiler-unshaded-v20210302.jar com/google/errorprone/error_prone_annotations/2.15.0/error_prone_annotations-2.15.0.jar
com/ibm/icu/icu4j/66.1/icu4j-66.1.jar com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar
commons-codec/commons-codec/1.10/commons-codec-1.10.jar com/google/guava/guava/31.0.1-jre/guava-31.0.1-jre.jar
com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar
com/google/javascript/closure-compiler-unshaded/v20230411/closure-compiler-unshaded-v20230411.jar
com/google/protobuf/protobuf-java/3.21.12/protobuf-java-3.21.12.jar
com/google/re2j/re2j/1.3/re2j-1.3.jar
commons-codec/commons-codec/1.15/commons-codec-1.15.jar
commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4.jar commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4.jar
commons-io/commons-io/2.6/commons-io-2.6.jar commons-io/commons-io/2.11.0/commons-io-2.11.0.jar
compojure/compojure/1.5.2/compojure-1.5.2.jar compojure/compojure/1.5.2/compojure-1.5.2.jar
com/taoensso/encore/2.105.0/encore-2.105.0.jar com/taoensso/encore/3.21.0/encore-3.21.0.jar
com/taoensso/timbre/4.10.0/timbre-4.10.0.jar com/taoensso/timbre/4.10.0/timbre-4.10.0.jar
com/taoensso/truss/1.5.0/truss-1.5.0.jar com/taoensso/truss/1.6.0/truss-1.6.0.jar
com/taoensso/tufte/2.1.0/tufte-2.1.0.jar com/taoensso/tufte/2.1.0/tufte-2.1.0.jar
com/wsscode/pathom/2.2.31/pathom-2.2.31.jar crypto-equality/crypto-equality/1.0.1/crypto-equality-1.0.1.jar
com/wsscode/spec-inspec/1.0.0-alpha2/spec-inspec-1.0.0-alpha2.jar crypto-random/crypto-random/1.2.1/crypto-random-1.2.1.jar
crypto-equality/crypto-equality/1.0.0/crypto-equality-1.0.0.jar
crypto-random/crypto-random/1.2.0/crypto-random-1.2.0.jar
day8/re-frame/test/0.1.5/test-0.1.5.jar day8/re-frame/test/0.1.5/test-0.1.5.jar
edn-query-language/eql/0.0.9/eql-0.0.9.jar expound/expound/0.9.0/expound-0.9.0.jar
expound/expound/0.8.5/expound-0.8.5.jar fipp/fipp/0.6.26/fipp-0.6.26.jar
fipp/fipp/0.6.23/fipp-0.6.23.jar
hiccup/hiccup/1.0.5/hiccup-1.0.5.jar hiccup/hiccup/1.0.5/hiccup-1.0.5.jar
hickory/hickory/0.7.1/hickory-0.7.1.jar hickory/hickory/0.7.1/hickory-0.7.1.jar
http-kit/http-kit/2.2.0/http-kit-2.2.0.jar http-kit/http-kit/2.2.0/http-kit-2.2.0.jar
instaparse/instaparse/1.4.0/instaparse-1.4.0.jar instaparse/instaparse/1.4.0/instaparse-1.4.0.jar
io/aviso/pretty/0.1.33/pretty-0.1.33.jar io/aviso/pretty/0.1.33/pretty-0.1.33.jar
io/methvin/directory-watcher/0.17.1/directory-watcher-0.17.1.jar
io/replikativ/datalog-parser/0.2.25/datalog-parser-0.2.25.jar
io/undertow/undertow-core/2.2.4.Final/undertow-core-2.2.4.Final.jar io/undertow/undertow-core/2.2.4.Final/undertow-core-2.2.4.Final.jar
javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
javax/servlet/servlet-api/2.5/servlet-api-2.5.jar javax/servlet/servlet-api/2.5/servlet-api-2.5.jar
javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar
medley/medley/0.8.2/medley-0.8.2.jar medley/medley/0.8.2/medley-0.8.2.jar
mvxcvi/alphabase/1.0.0/alphabase-1.0.0.jar mvxcvi/alphabase/1.0.0/alphabase-1.0.0.jar
net/cgrand/macrovich/0.2.1/macrovich-0.2.1.jar net/cgrand/macrovich/0.2.1/macrovich-0.2.1.jar
net/java/dev/jna/jna/5.12.1/jna-5.12.1.jar
nrepl/bencode/1.1.0/bencode-1.1.0.jar
nrepl/nrepl/1.0.0/nrepl-1.0.0.jar nrepl/nrepl/1.0.0/nrepl-1.0.0.jar
org/clojure/clojure/1.10.1/clojure-1.10.1.jar org/apache/ant/ant/1.10.11/ant-1.10.11.jar
org/clojure/clojurescript/1.10.844/clojurescript-1.10.844.jar org/apache/ant/ant-launcher/1.10.11/ant-launcher-1.10.11.jar
org/clojure/core.async/1.3.610/core.async-1.3.610.jar org/babashka/sci/0.7.38/sci-0.7.38.jar
org/clojure/core.cache/1.0.207/core.cache-1.0.207.jar org/babashka/sci.impl.types/0.0.2/sci.impl.types-0.0.2.jar
org/clojure/core.memoize/1.0.236/core.memoize-1.0.236.jar org/checkerframework/checker-qual/3.12.0/checker-qual-3.12.0.jar
org/clojure/core.rrb-vector/0.1.1/core.rrb-vector-0.1.1.jar org/clojure/clojure/1.11.1/clojure-1.11.1.jar
org/clojure/core.specs.alpha/0.2.44/core.specs.alpha-0.2.44.jar org/clojure/clojurescript/1.11.60/clojurescript-1.11.60.jar
org/clojure/data.json/1.0.0/data.json-1.0.0.jar org/clojure/core.async/1.5.648/core.async-1.5.648.jar
org/clojure/data.priority-map/1.0.0/data.priority-map-1.0.0.jar org/clojure/core.cache/1.0.225/core.cache-1.0.225.jar
org/clojure/google-closure-library/0.0-20201211-3e6c510d/google-closure-library-0.0-20201211-3e6c510d.jar org/clojure/core.memoize/1.0.253/core.memoize-1.0.253.jar
org/clojure/google-closure-library-third-party/0.0-20201211-3e6c510d/google-closure-library-third-party-0.0-20201211-3e6c510d.jar org/clojure/core.rrb-vector/0.1.2/core.rrb-vector-0.1.2.jar
org/clojure/spec.alpha/0.2.176/spec.alpha-0.2.176.jar org/clojure/core.specs.alpha/0.2.62/core.specs.alpha-0.2.62.jar
org/clojure/test.check/1.1.0/test.check-1.1.0.jar org/clojure/data.json/2.4.0/data.json-2.4.0.jar
org/clojure/tools.analyzer/1.0.0/tools.analyzer-1.0.0.jar org/clojure/data.priority-map/1.1.0/data.priority-map-1.1.0.jar
org/clojure/tools.analyzer.jvm/1.1.0/tools.analyzer.jvm-1.1.0.jar org/clojure/google-closure-library/0.0-20230227-c7c0a541/google-closure-library-0.0-20230227-c7c0a541.jar
org/clojure/tools.cli/1.0.194/tools.cli-1.0.194.jar org/clojure/google-closure-library-third-party/0.0-20230227-c7c0a541/google-closure-library-third-party-0.0-20230227-c7c0a541.jar
org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.jar
org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0.jar
org/clojure/tools.analyzer.jvm/1.2.2/tools.analyzer.jvm-1.2.2.jar
org/clojure/tools.cli/1.0.206/tools.cli-1.0.206.jar
org/clojure/tools.logging/1.1.0/tools.logging-1.1.0.jar org/clojure/tools.logging/1.1.0/tools.logging-1.1.0.jar
org/clojure/tools.macro/0.1.5/tools.macro-0.1.5.jar org/clojure/tools.macro/0.1.5/tools.macro-0.1.5.jar
org/clojure/tools.reader/1.3.3/tools.reader-1.3.3.jar org/clojure/tools.reader/1.3.6/tools.reader-1.3.6.jar
org/graalvm/js/js/20.1.0/js-20.1.0.jar
org/graalvm/js/js-scriptengine/20.1.0/js-scriptengine-20.1.0.jar
org/graalvm/regex/regex/20.1.0/regex-20.1.0.jar
org/graalvm/sdk/graal-sdk/20.1.0/graal-sdk-20.1.0.jar
org/graalvm/truffle/truffle-api/20.1.0/truffle-api-20.1.0.jar
org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar
org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final.jar org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final.jar
org/jboss/threads/jboss-threads/3.1.0.Final/jboss-threads-3.1.0.Final.jar org/jboss/threads/jboss-threads/3.1.0.Final/jboss-threads-3.1.0.Final.jar
org/jboss/xnio/xnio-api/3.8.0.Final/xnio-api-3.8.0.Final.jar org/jboss/xnio/xnio-api/3.8.0.Final/xnio-api-3.8.0.Final.jar
org/jboss/xnio/xnio-nio/3.8.0.Final/xnio-nio-3.8.0.Final.jar org/jboss/xnio/xnio-nio/3.8.0.Final/xnio-nio-3.8.0.Final.jar
org/jsoup/jsoup/1.9.2/jsoup-1.9.2.jar org/jsoup/jsoup/1.9.2/jsoup-1.9.2.jar
org/jspecify/jspecify/0.2.0/jspecify-0.2.0.jar
org/msgpack/msgpack/0.6.12/msgpack-0.6.12.jar org/msgpack/msgpack/0.6.12/msgpack-0.6.12.jar
org/ow2/asm/asm/7.1/asm-7.1.jar org/ow2/asm/asm/9.4/asm-9.4.jar
org/ow2/asm/asm-analysis/7.1/asm-analysis-7.1.jar org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar
org/ow2/asm/asm-commons/7.1/asm-commons-7.1.jar
org/ow2/asm/asm-tree/7.1/asm-tree-7.1.jar
org/ow2/asm/asm-util/7.1/asm-util-7.1.jar
org/wildfly/client/wildfly-client-config/1.0.1.Final/wildfly-client-config-1.0.1.Final.jar org/wildfly/client/wildfly-client-config/1.0.1.Final/wildfly-client-config-1.0.1.Final.jar
org/wildfly/common/wildfly-common/1.5.2.Final/wildfly-common-1.5.2.Final.jar org/wildfly/common/wildfly-common/1.5.2.Final/wildfly-common-1.5.2.Final.jar
prismatic/schema/1.1.7/schema-1.1.7.jar prismatic/schema/1.1.7/schema-1.1.7.jar
quoin/quoin/0.1.2/quoin-0.1.2.jar quoin/quoin/0.1.2/quoin-0.1.2.jar
reagent/reagent/1.2.0/reagent-1.2.0.jar reagent/reagent/1.2.0/reagent-1.2.0.jar
re-com/re-com/2.8.0/re-com-2.8.0.jar re-com/re-com/2.8.0/re-com-2.8.0.jar
refactor-nrepl/refactor-nrepl/3.6.0/refactor-nrepl-3.6.0.jar refactor-nrepl/refactor-nrepl/2.5.0/refactor-nrepl-2.5.0.jar
re-frame/re-frame/1.3.0/re-frame-1.3.0.jar re-frame/re-frame/1.3.0/re-frame-1.3.0.jar
re-frisk-remote/re-frisk-remote/1.6.0/re-frisk-remote-1.6.0.jar re-frisk-remote/re-frisk-remote/1.6.0/re-frisk-remote-1.6.0.jar
re-frisk/sente/1.15.0/sente-1.15.0.jar re-frisk/sente/1.15.0/sente-1.15.0.jar
ring-cors/ring-cors/0.1.8/ring-cors-0.1.8.jar ring-cors/ring-cors/0.1.8/ring-cors-0.1.8.jar
ring/ring-codec/1.1.2/ring-codec-1.1.2.jar ring/ring-codec/1.2.0/ring-codec-1.2.0.jar
ring/ring-core/1.8.1/ring-core-1.8.1.jar ring/ring-core/1.9.6/ring-core-1.9.6.jar
spec-coerce/spec-coerce/1.0.0-alpha6/spec-coerce-1.0.0-alpha6.jar
status-im/timbre/4.10.0-2-status/timbre-4.10.0-2-status.jar status-im/timbre/4.10.0-2-status/timbre-4.10.0-2-status.jar
thheller/shadow-client/1.3.3/shadow-client-1.3.3.jar thheller/shadow-client/1.3.3/shadow-client-1.3.3.jar
thheller/shadow-cljs/2.12.0/shadow-cljs-2.12.0-aot.jar thheller/shadow-cljs/2.25.0/shadow-cljs-2.25.0-aot.jar
thheller/shadow-cljsjs/0.0.21/shadow-cljsjs-0.0.21.jar thheller/shadow-cljsjs/0.0.22/shadow-cljsjs-0.0.22.jar
thheller/shadow-undertow/0.1.0/shadow-undertow-0.1.0.jar thheller/shadow-undertow/0.3.1/shadow-undertow-0.3.1.jar
thheller/shadow-util/0.7.0/shadow-util-0.7.0.jar thheller/shadow-util/0.7.0/shadow-util-0.7.0.jar
tigris/tigris/0.1.2/tigris-0.1.2.jar
viebel/codox-klipse-theme/0.0.1/codox-klipse-theme-0.0.1.jar viebel/codox-klipse-theme/0.0.1/codox-klipse-theme-0.0.1.jar

View File

@ -11,11 +11,16 @@
[com.cognitect/transit-cljs "0.8.248"] [com.cognitect/transit-cljs "0.8.248"]
[mvxcvi/alphabase "1.0.0"] [mvxcvi/alphabase "1.0.0"]
[camel-snake-kebab "0.4.3"] [camel-snake-kebab "0.4.3"]
;; Dev dependencies ;; Dev dependencies
[refactor-nrepl "2.5.0"] [refactor-nrepl "2.5.0"]
[cider/cider-nrepl "0.25.3"] [cider/cider-nrepl "0.25.3"]
[cider/piggieback "0.4.1"] [cider/piggieback "0.4.1"]
[re-frisk-remote "1.6.0"] [re-frisk-remote "1.6.0"]
;; Use the same version specified in the Nix dependency.
[clj-kondo/clj-kondo "2023.09.07"]
;; We don't use the encore library, but re-frisk requires re-frisk/sente (fork of ;; We don't use the encore library, but re-frisk requires re-frisk/sente (fork of
;; com.taoensso/sente), which in turn requires encore. We need to bump encore to ;; com.taoensso/sente), which in turn requires encore. We need to bump encore to
;; 3.21.0+ to remove a warning displayed while shadow-cljs starts (commit ;; 3.21.0+ to remove a warning displayed while shadow-cljs starts (commit

View File

@ -171,7 +171,7 @@
:style {:flex-shrink 1} :style {:flex-shrink 1}
:size :paragraph-2} :size :paragraph-2}
pinned-by] pinned-by]
[split-text (i18n/label :pinned-a-message) theme true] [split-text (i18n/label :t/pinned-a-message) theme true]
[sm-timestamp timestamp theme]] [sm-timestamp timestamp theme]]
(when child child)]]) (when child child)]])

View File

@ -6,7 +6,6 @@
[status-im.chat.models.mentions :as mentions] [status-im.chat.models.mentions :as mentions]
[status-im.chat.models.message :as chat.message] [status-im.chat.models.message :as chat.message]
[status-im.chat.models.message-content :as message-content] [status-im.chat.models.message-content :as message-content]
[status-im.utils.utils :as utils]
[status-im2.constants :as constants] [status-im2.constants :as constants]
[status-im2.contexts.chat.composer.link-preview.events :as link-preview] [status-im2.contexts.chat.composer.link-preview.events :as link-preview]
[taoensso.timbre :as log] [taoensso.timbre :as log]
@ -26,12 +25,6 @@
original)))) original))))
;; effects ;; effects
(re-frame/reg-fx
:show-cooldown-warning
(fn [_]
(utils/show-popup nil
(i18n/label :cooldown/warning-message)
#())))
(rf/defn set-chat-input-text (rf/defn set-chat-input-text
"Set input text for current-chat. Takes db and input text and cofx "Set input text for current-chat. Takes db and input text and cofx

View File

@ -79,7 +79,7 @@
;; line height specified here because of figma spec ;; line height specified here because of figma spec
:line-height 20 :line-height 20
:font-size 14}} :font-size 14}}
(i18n/label :sharing-copied-to-clipboard)]]]) (i18n/label :t/sharing-copied-to-clipboard)]]])
(defn copyable-text-view (defn copyable-text-view
[{:keys [label container-style]} content] [{:keys [label container-style]} content]

View File

@ -33,7 +33,7 @@
[react/text [react/text
{:style styles/go-to-settings {:style styles/go-to-settings
:on-press #(re-frame/dispatch [:mobile-network/navigate-to-settings])} :on-press #(re-frame/dispatch [:mobile-network/navigate-to-settings])}
(i18n/label :mobile-network-go-to-settings)]]) (i18n/label :t/mobile-network-go-to-settings)]])
(views/defview checkbox (views/defview checkbox
[] []
@ -48,7 +48,7 @@
:on-value-change #(re-frame/dispatch [:mobile-network/remember-choice? %])}] :on-value-change #(re-frame/dispatch [:mobile-network/remember-choice? %])}]
[react/view [react/view
{:style styles/checkbox-text-container} {:style styles/checkbox-text-container}
[react/text (i18n/label :mobile-network-sheet-remember-choice)]]])) [react/text (i18n/label :t/mobile-network-sheet-remember-choice)]]]))
(defn settings (defn settings
[] []
@ -57,9 +57,9 @@
[react/nested-text [react/nested-text
{:style styles/settings-text {:style styles/settings-text
:on-press #(re-frame/dispatch [:mobile-network/navigate-to-settings])} :on-press #(re-frame/dispatch [:mobile-network/navigate-to-settings])}
(i18n/label :mobile-network-sheet-configure) (i18n/label :t/mobile-network-sheet-configure)
[{:style styles/settings-link} [{:style styles/settings-link}
(str " " (i18n/label :mobile-network-sheet-settings))]]]) (str " " (i18n/label :t/mobile-network-sheet-settings))]]])
(defn hide-sheet-and-dispatch (defn hide-sheet-and-dispatch
[event] [event]

View File

@ -663,7 +663,7 @@
:component keycard.pairing/change-pairing-code} :component keycard.pairing/change-pairing-code}
{:name :show-all-connections {:name :show-all-connections
:options {:topBar {:title {:text (i18n/label :all-connections)}} :options {:topBar {:title {:text (i18n/label :t/all-connections)}}
:insets {:bottom? true :insets {:bottom? true
:top? true}} :top? true}}
:component manage-all-connections/views} :component manage-all-connections/views}

View File

@ -58,7 +58,7 @@
(when (seq learn-more-url) (when (seq learn-more-url)
[react/touchable-highlight {:on-press #(re-frame/dispatch [:browser.ui/open-url learn-more-url])} [react/touchable-highlight {:on-press #(re-frame/dispatch [:browser.ui/open-url learn-more-url])}
[react/view {:padding-vertical 11} [react/view {:padding-vertical 11}
[quo/text {:color :link} (i18n/label :learn-more)]]])]) [quo/text {:color :link} (i18n/label :t/learn-more)]]])])
(views/defview buy-crypto (views/defview buy-crypto
[] []
@ -124,8 +124,8 @@
site-url site-url
@webview-ref) @webview-ref)
:java-script-enabled true :java-script-enabled true
;; This is to avoid crashes on android devices ;; This is to avoid crashes on android devices due to
;; due to https://github.com/react-native-webview/react-native-webview/issues/1838 ;; https://github.com/react-native-webview/react-native-webview/issues/1838
;; We can't disable hardware acceleration as we need to use camera ;; We can't disable hardware acceleration as we need to use camera
:style {:opacity 0.99} :style {:opacity 0.99}
:local-storage-enabled true :local-storage-enabled true

View File

@ -162,8 +162,7 @@
(cond (cond
fetching? [nft-assets-skeleton num-assets] fetching? [nft-assets-skeleton num-assets]
;; <shivekkhurana> OpenSea sometimes doesn't return an asset ;; <shivekkhurana> OpenSea sometimes doesn't return an asset. This condition handles it
;; This condition handles it
(and (not fetching?) (and (not fetching?)
(not (seq assets))) (not (seq assets)))
[no-assets-error] [no-assets-error]
@ -240,7 +239,7 @@
[::multiaccounts.update/toggle-opensea-nfts-visiblity true]) [::multiaccounts.update/toggle-opensea-nfts-visiblity true])
:theme :main :theme :main
:type :primary} :type :primary}
(i18n/label :display-collectibles)]] (i18n/label :t/display-collectibles)]]
[quo/text [quo/text
{:size :small {:size :small
:color :secondary :color :secondary
@ -285,14 +284,10 @@
;; TODO <shivekkhurana>: Enable txns ;; TODO <shivekkhurana>: Enable txns
;; [quo/list-item {:title (i18n/label :t/wallet-send) ;; [quo/list-item {:title (i18n/label :t/wallet-send)
;; :icon :main-icons/send ;; :icon :main-icons/send :accessibility-label :nft-send :theme :accent
;; :accessibility-label
;; :nft-send
;; :theme :accent
;; :on-press #()}] ;; :on-press #()}]
;; TODO <shivekkhurana>: What to do with share? ;; TODO <shivekkhurana>: What to do with share? Share links or share image?
;; Share links or share image?
;; [quo/list-item {:title (i18n/label :t/share) ;; [quo/list-item {:title (i18n/label :t/share)
;; :theme :accent ;; :theme :accent
;; :accessibility-label ;; :accessibility-label
@ -307,7 +302,7 @@
(when (is-image? nft) (when (is-image? nft)
[toastable-highlight-view [toastable-highlight-view
;; the last string is an emoji. It might not show up in all editors but its there ;; the last string is an emoji. It might not show up in all editors but its there
{:toast-label (str (i18n/label :profile-picture-updated)) " " "😎"} {:toast-label (str (i18n/label :t/profile-picture-updated)) " " "😎"}
[quo/list-item [quo/list-item
{:title (i18n/label :t/use-as-profile-picture) {:title (i18n/label :t/use-as-profile-picture)
:theme :accent :theme :accent

View File

@ -67,7 +67,7 @@
:imageErrorColor :red :imageErrorColor :red
:sensorDescription (i18n/label :t/biometric-auth-android-sensor-desc) :sensorDescription (i18n/label :t/biometric-auth-android-sensor-desc)
:sensorErrorDescription (i18n/label :t/biometric-auth-android-sensor-error-desc) :sensorErrorDescription (i18n/label :t/biometric-auth-android-sensor-error-desc)
:cancelText (i18n/label :cancel)}))} :cancelText (i18n/label :t/cancel)}))}
options)))) options))))
(rf/defn authenticate (rf/defn authenticate

View File

@ -184,7 +184,7 @@
:accessibility-label :audio-error-label :accessibility-label :audio-error-label
:weight :medium :weight :medium
:size :paragraph-2} :size :paragraph-2}
(i18n/label :error-loading-audio)] (i18n/label :t/error-loading-audio)]
[rn/view [rn/view
{:accessibility-label :audio-message-container {:accessibility-label :audio-message-container
:style (style/container)} :style (style/container)}

View File

@ -71,7 +71,7 @@
:on-press #(rf/dispatch [:navigate-to :community :on-press #(rf/dispatch [:navigate-to :community
{:from-chat true {:from-chat true
:community-id (:id community)}])} :community-id (:id community)}])}
(i18n/label :view)]])) (i18n/label :t/view)]]))
(defn community-preview-loader (defn community-preview-loader
[community-link] [community-link]
@ -149,7 +149,7 @@
[quo/button [quo/button
{:type :grey {:type :grey
:on-press #(rf/dispatch [:open-modal :link-preview-settings])} :on-press #(rf/dispatch [:open-modal :link-preview-settings])}
(i18n/label :enable)] (i18n/label :t/enable)]
[rn/view (style/separator)] [rn/view (style/separator)]
[quo/button [quo/button
{:type :grey {:type :grey

View File

@ -34,11 +34,10 @@
item])) item]))
(def tabs-data (def tabs-data
[{:id :joined :label (i18n/label :chats/joined) :accessibility-label :joined-tab} [{:id :joined :label (i18n/label :t/joined) :accessibility-label :joined-tab}
{:id :pending :label (i18n/label :t/pending) :accessibility-label :pending-tab} {:id :pending :label (i18n/label :t/pending) :accessibility-label :pending-tab}
{:id :opened :label (i18n/label :t/opened) :accessibility-label :opened-tab}]) {:id :opened :label (i18n/label :t/opened) :accessibility-label :opened-tab}])
(defn empty-state-content (defn empty-state-content
[theme] [theme]
{:joined {:joined

View File

@ -12,10 +12,10 @@
(case users-count (case users-count
0 "" 0 ""
1 (i18n/label :t/join-one-user {:user (first first-two)}) 1 (i18n/label :t/join-one-user {:user (first first-two)})
2 (i18n/label :join-two-users 2 (i18n/label :t/join-two-users
{:user1 (first first-two) {:user1 (first first-two)
:user2 (second first-two)}) :user2 (second first-two)})
(i18n/label :join-more-users (i18n/label :t/join-more-users
{:user1 (first first-two) {:user1 (first first-two)
:user2 (second first-two) :user2 (second first-two)
:left-count (- users-count 2)})))) :left-count (- users-count 2)}))))

View File

@ -64,8 +64,8 @@
(defn delete-profile-confirmation (defn delete-profile-confirmation
[key-uid context] [key-uid context]
[confirmation-drawer/confirmation-drawer [confirmation-drawer/confirmation-drawer
{:title (i18n/label :remove-profile?) {:title (i18n/label :t/remove-profile?)
:description (i18n/label :remove-profile-confirm-message) :description (i18n/label :t/remove-profile-confirm-message)
:accessibility-label :remove-profile-confirm :accessibility-label :remove-profile-confirm
:context context :context context
:button-text (i18n/label :t/remove) :button-text (i18n/label :t/remove)
@ -88,7 +88,7 @@
[key-uid context] [key-uid context]
[quo/action-drawer [quo/action-drawer
[[{:icon :i/delete [[{:icon :i/delete
:label (i18n/label :remove-profile-message) :label (i18n/label :t/remove-profile-message)
:on-press #(show-confirmation key-uid context) :on-press #(show-confirmation key-uid context)
:accessibility-label :remove-profile :accessibility-label :remove-profile
:danger? true}]]]) :danger? true}]]])

View File

@ -14,7 +14,7 @@
:timestamp-near "Mar 8 · 22:42" :timestamp-near "Mar 8 · 22:42"
:on-info-button-pressed identity :on-info-button-pressed identity
:on-press #(println "fill gaps") :on-press #(println "fill gaps")
:warning-label (i18n/label :messages-gap-warning)})] :warning-label (i18n/label :t/messages-gap-warning)})]
(fn [] (fn []
[preview/preview-container [preview/preview-container
{:state state {:state state

View File

@ -92,8 +92,8 @@
(and (= constants/private-group-chat-type chat-type) ; it's a private group chat (and (= constants/private-group-chat-type chat-type) ; it's a private group chat
(or (not (pos? joined)) ; we haven't joined (or (not (pos? joined)) ; we haven't joined
(>= (quot joined 1000) synced-from))) ; the history goes before we joined (>= (quot joined 1000) synced-from))) ; the history goes before we joined
(:gap-ids (peek messages-with-gaps))) ; there's already a gap on top of the chat (:gap-ids (peek messages-with-gaps))) ; there's already a gap on top of the
; history ; chat history
messages-with-gaps ; don't add an extra gap messages-with-gaps ; don't add an extra gap
(conj messages-with-gaps (last-gap chat-id synced-from))))) (conj messages-with-gaps (last-gap chat-id synced-from)))))
@ -186,7 +186,7 @@
(defn message-text (defn message-text
[{:keys [content-type] :as message}] [{:keys [content-type] :as message}]
(cond (= content-type constants/content-type-audio) (cond (= content-type constants/content-type-audio)
(i18n/label :audio-message) (i18n/label :t/audio-message)
:else :else
(get-in message [:content :parsed-text]))) (get-in message [:content :parsed-text])))

View File

@ -42,7 +42,7 @@
(if (= type :inbound) (if (= type :inbound)
[from :from-contact :to-wallet] [from :from-contact :to-wallet]
[to :to-contact :from-wallet]) [to :to-contact :from-wallet])
wallet (i18n/label :main-wallet) wallet (i18n/label :t/main-wallet)
contact (get contacts contact-address) contact (get contacts contact-address)
{:keys [symbol-display decimals] :as asset} {:keys [symbol-display decimals] :as asset}
(or token native-currency) (or token native-currency)
@ -70,11 +70,7 @@
(assoc acc (assoc acc
tx-hash tx-hash
(enrich-transaction transaction contacts native-currency))) ;;TODO this doesn't (enrich-transaction transaction contacts native-currency))) ;;TODO this doesn't
;;look good for ;;look good for performance, we need to calculate this only once for each transaction
;;performance, we
;;need to calculate
;;this only once for
;;each transaction
{} {}
transactions))) transactions)))
@ -210,12 +206,12 @@
"-") "-")
:date (datetime/timestamp->long-date timestamp)} :date (datetime/timestamp->long-date timestamp)}
(if (= type :unsigned) (if (= type :unsigned)
{:block (i18n/label :not-applicable) {:block (i18n/label :t/not-applicable)
:cost (i18n/label :not-applicable) :cost (i18n/label :t/not-applicable)
:gas-limit (i18n/label :not-applicable) :gas-limit (i18n/label :t/not-applicable)
:gas-used (i18n/label :not-applicable) :gas-used (i18n/label :t/not-applicable)
:nonce (i18n/label :not-applicable) :nonce (i18n/label :t/not-applicable)
:hash (i18n/label :not-applicable)} :hash (i18n/label :t/not-applicable)}
{:cost (when gas-used {:cost (when gas-used
(money/wei->str :eth (money/wei->str :eth
(money/fee-value gas-used gas-price) (money/fee-value gas-used gas-price)