File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- [
2- {"id" : " wallet" ,
3- "name" : " Wallet" ,
4- "photo-path" : " icon_wallet_avatar" ,
5- "add-chat?" : true ,
6- "dapp?" : true },
1+ {
2+ "wallet" :
3+ {
4+ "name" :
5+ {
6+ "en" : " Wallet" ,
7+ "es" : " Monedero" ,
8+ "es-ar" : " Monedero" ,
9+ "ru" : " Кошелек"
10+ },
11+ "photo-path" : " icon_wallet_avatar" ,
12+ "add-chat?" : true ,
13+ "dapp?" : true
14+ },
715
8- {"id" : " dapp-auction-house" ,
9- "name" : " Auction House" ,
10- "photo-path" : " contacts://auction-house" ,
11- "dapp?" : true ,
12- "dapp-url" : " http://auctionhouse.dappbench.com" }
13- ]
16+ "auction-house" :
17+ {
18+ "name" :
19+ {
20+ "en" : " Auction House"
21+ },
22+ "photo-path" : " contacts://auction-house" ,
23+ "dapp?" : true ,
24+ "dapp-url" :
25+ {
26+ "en" : " http://auctionhouse.dappbench.com"
27+ }
28+ }
29+ }
Original file line number Diff line number Diff line change 2929 [status-im.components.chat-icon.screen :refer [chat-icon-message-status]]
3030 [status-im.utils.identicon :refer [identicon]]
3131 [status-im.utils.gfycat.core :refer [generate-gfy]]
32- [status-im.i18n :refer [label]]
32+ [status-im.i18n :refer [label
33+ get-contact-translated]]
3334 [status-im.chat.utils :as cu]
3435 [clojure.string :as str]
3536 [status-im.chat.handlers.console :as console]
5556 :number-of-lines 1 }
5657 (if (str/blank? @name)
5758 (generate-gfy )
58- (or @name (label :t/chat-name )))]
59+ (or (get-contact-translated @chat-id :name @name)
60+ (label :t/chat-name )))]
5961 (when (or status content)
6062 [text {:style st/status-text
6163 :font :default }
Original file line number Diff line number Diff line change 66 [status-im.components.react :refer [view
77 text
88 icon]]
9- [status-im.i18n :refer [label label-pluralize]]
9+ [status-im.i18n :refer [get-contact-translated
10+ label
11+ label-pluralize]]
1012 [status-im.chat.styles.screen :as st]
1113 [status-im.components.refreshable-text.view :refer [refreshable-text]]
1214 [status-im.utils.datetime :as time]
7577 :font :toolbar-title }
7678 (if (str/blank? @name)
7779 (generate-gfy )
78- (or @name (label :t/chat-name )))]
80+ (or (get-contact-translated @chat-id :name @name)
81+ (label :t/chat-name )))]
7982 (if @group-chat
8083 [group-last-activity {:contacts @contacts
8184 :sync-state @sync-state}]
Original file line number Diff line number Diff line change 77 [status-im.models.commands :refer [parse-command-message-content]]
88 [status-im.chats-list.styles :as st]
99 [status-im.utils.utils :refer [truncate-str]]
10- [status-im.i18n :refer [label label-pluralize]]
10+ [status-im.i18n :refer [get-contact-translated label label-pluralize]]
1111 [status-im.utils.datetime :as time]
1212 [status-im.utils.gfycat.core :refer [generate-gfy]]
1313 [status-im.constants :refer [console-chat-id
8080 online group-chat contacts] :as chat}]
8181 (let [last-message (or (first (sort-by :clock-value > (:messages chat)))
8282 last-message)
83- name (or name (generate-gfy ))]
83+ name (or (get-contact-translated chat-id :name name)
84+ (generate-gfy ))]
8485 [view st/chat-container
8586 [view st/chat-icon-container
8687 [chat-icon-view-chat-list chat-id group-chat name color online]]
Original file line number Diff line number Diff line change 99 [status-im.components.react :as r]
1010 [status-im.models.commands :as cm]
1111 [status-im.constants :refer [console-chat-id]]
12+ [status-im.i18n :refer [get-contact-translated]]
1213 [taoensso.timbre :as log]))
1314
1415(defn render-command
4748 {:keys [dapp? dapp-url]} (get contacts chat-id)
4849 hiccup (generate-hiccup markup)
4950 web-view-url (if (and (= webViewUrl " dapp-url" ) dapp? dapp-url)
50- dapp-url
51+ ( get-contact-translated chat-id : dapp-url dapp-url)
5152 webViewUrl)]
5253 (-> db
5354 (assoc-in [:suggestions chat-id] hiccup)
Original file line number Diff line number Diff line change 167167(reg-handler :load-default-contacts!
168168 (u/side-effect!
169169 (fn [{:keys [chats]}]
170- (let [contacts ( json->clj js-res/default-contacts-js)]
171- ( doseq [{ :keys [id name photo-path public-key add-chat?
172- dapp? dapp-url dapp-hash] :as contact} contacts ]
170+ (doseq [[id { :keys [name photo-path public-key add-chat?
171+ dapp? dapp-url dapp-hash] :as contact}] js-res/default-contacts]
172+ ( let [id ( clojure.core/name id) ]
173173 (when-not (chats id)
174174 (when add-chat?
175- (dispatch [:add-chat id {:name name}]))
175+ (dispatch [:add-chat id {:name ( :en name) }]))
176176 (dispatch [:add-contacts [{:whisper-identity id
177- :name name
177+ :name ( :en name)
178178 :photo-path photo-path
179179 :public-key public-key
180180 :dapp? dapp?
181- :dapp-url dapp-url
181+ :dapp-url ( :en dapp-url)
182182 :dapp-hash dapp-hash}]])))))))
Original file line number Diff line number Diff line change 44 [status-im.components.chat-icon.screen :refer [contact-icon-contacts-tab]]
55 [status-im.contacts.styles :as st]
66 [status-im.utils.gfycat.core :refer [generate-gfy]]
7- [status-im.i18n :refer [label]]))
7+ [status-im.i18n :refer [get-contact-translated label]]))
88
99(defn contact-photo [contact]
1010 [view st/contact-photo-container
1313(defn contact-inner-view
1414 ([contact]
1515 (contact-inner-view contact nil ))
16- ([{:keys [name] :as contact} info]
16+ ([{:keys [whisper-identity name] :as contact} info]
1717 [view st/contact-inner-container
1818 [contact-photo contact]
1919 [view st/info-container
2020 [text {:style st/name-text
2121 :number-of-lines 1 }
2222 (if (pos? (count (:name contact)))
23- name
23+ ( get-contact-translated whisper-identity : name name)
2424 ; ; todo is this correct behaviour?
2525 (generate-gfy ))]
2626 (when info
Original file line number Diff line number Diff line change 3333 [status-im.translations.zh-hant :as zh-hant]
3434 [status-im.translations.zh-wuu :as zh-wuu]
3535 [status-im.translations.zh-yue :as zh-yue]
36- [status-im.utils.utils :as u]))
36+ [status-im.utils.utils :as u]
37+ [status-im.utils.js-resources :refer [default-contacts ]]))
3738
3839(def i18n (js/require " react-native-i18n" ))
3940(set! (.-fallbacks i18n) true )
9192 (str " t/status-" )
9293 (keyword )
9394 (label )))
95+
96+ (def locale
97+ (.-locale i18n))
98+
99+ (defn get-contact-translated [contact-id key fallback]
100+ (let [translation #(get-in default-contacts [(keyword contact-id) key (keyword %)])]
101+ (or (translation locale)
102+ (translation (subs locale 0 2 ))
103+ fallback)))
Original file line number Diff line number Diff line change 3232 [status-im.utils.random :refer [id]]
3333 [status-im.utils.utils :refer [clean-text]]
3434 [status-im.components.image-button.view :refer [show-qr-button]]
35- [status-im.i18n :refer [label]]))
35+ [status-im.i18n :refer [label
36+ get-contact-translated]]))
3637
3738(defn share [text dialog-title]
3839 (let [list-selection-fn (:list-selection-fn platform-specific)]
7273 (r/set-state component {:height height}))]
7374 (r/create-class
7475 {:reagent-render
75- (fn [{{:keys [name status photo-path]} :account
76- edit? :edit? }]
76+ (fn [{{:keys [whisper-identity
77+ name
78+ status
79+ photo-path]} :account
80+ edit? :edit? }]
7781 [view st/status-block
7882 [view st/user-photo-container
7983
9498 :editable edit?
9599 :input-style (st/username-input edit? (s/valid? ::v/name name))
96100 :wrapper-style st/username-wrapper
97- :value name
101+ :value ( get-contact-translated whisper-identity : name name)
98102 :on-change-text #(dispatch [:set-in [:profile-edit :name ] %])}]
99103 (if (or edit? @just-opened?)
100104 [text-input {:ref #(reset! input-ref %)
You can’t perform that action at this time.
0 commit comments