diff --git a/src/status_im/chat/screen.cljs b/src/status_im/chat/screen.cljs index 19723aba22..8c20bb1136 100644 --- a/src/status_im/chat/screen.cljs +++ b/src/status_im/chat/screen.cljs @@ -17,7 +17,8 @@ [status-im.components.invertible-scroll-view :refer [invertible-scroll-view]] [status-im.components.toolbar :refer [toolbar]] [status-im.chat.views.message :refer [chat-message]] - [status-im.chat.views.new-message :refer [chat-message-new]])) + [status-im.chat.views.new-message :refer [chat-message-new]] + [status-im.i18n :refer [label]])) (defn contacts-by-identity [contacts] @@ -46,7 +47,7 @@ [view st/typing-view [view st/typing-background [text {:style st/typing-text} - (str member " is typing")]]]) + (str member " " (label :t/is-typing))]]]) (defn typing-all [] [view st/typing-all @@ -100,63 +101,63 @@ [chat-icon-view-menu-item chat-id group-chat name color true]) (defn members-text [members] - (truncate-str (str (s/join ", " (map #(:name %) members)) " and you") 35)) + (truncate-str (str (s/join ", " (map #(:name %) members)) " " (label :t/and-you)) 35)) (defn actions-list-view [] (let [{:keys [group-chat chat-id]} (subscribe [:chat-properties [:group-chat :chat-id]]) members (subscribe [:current-chat-contacts])] (when-let [actions (if @group-chat - [{:title "Members" + [{:title (label :t/members-title) :subtitle (members-text @members) :icon :menu_group :icon-style {:width 25 :height 19} ;; TODO not implemented: action Members :handler nil} - {:title "Search chat" - :subtitle "!not implemented" + {:title (label :t/search-chat) + :subtitle (label :t/not-implemented) :icon :search_gray_copy :icon-style {:width 17 :height 17} ;; TODO not implemented: action Search chat :handler nil} - {:title "Notifications and sounds" - :subtitle "!not implemented" + {:title (label :t/notifications-title) + :subtitle (label :t/not-implemented) ;;:subtitle "Chat muted" :icon :muted :icon-style {:width 18 :height 21} ;; TODO not implemented: action Notifications :handler nil} - {:title "Settings" + {:title (label :t/settings) :icon :settings :icon-style {:width 20 :height 13} :handler #(dispatch [:show-group-settings])}] - [{:title "Profile" + [{:title (label :t/profile) :custom-icon [menu-item-icon-profile] :icon :menu_group :icon-style {:width 25 :height 19} :handler #(dispatch [:show-profile @chat-id])} - {:title "Search chat" - :subtitle "!not implemented" + {:title (label :t/search-chat) + :subtitle (label :t/not-implemented) :icon :search_gray_copy :icon-style {:width 17 :height 17} ;; TODO not implemented: action Search chat :handler nil} - {:title "Notifications and sounds" - :subtitle "!not implemented" + {:title (label :t/notifications-title) + :subtitle (label :t/not-implemented) ;;:subtitle "Notifications on" :icon :muted :icon-style {:width 18 :height 21} ;; TODO not implemented: action Notifications :handler nil} - {:title "Settings" - :subtitle "!not implemented" + {:title (label :t/settings) + :subtitle (label :t/not-implemented) :icon :settings :icon-style {:width 20 :height 13} @@ -179,20 +180,15 @@ (fn [] [view (st/chat-name-view @show-actions) [text {:style st/chat-name-text} - (truncate-str (or @name "Chat name") 30)] + (truncate-str (or @name (label :t/chat-name)) 30)] (if @group-chat [view {:flexDirection :row} [icon :group st/group-icon] [text {:style st/members} (let [cnt (inc (count @contacts))] - (str cnt - (if (< 1 cnt) - " members" - " member") - ;; TODO stub data: active members - ", " cnt " active"))]] + (label :t/members {:count cnt}))]] ;; TODO stub data: last activity - [text {:style st/last-activity} "Active a minute ago"])]))) + [text {:style st/last-activity} (label :t/last-active)])]))) (defn toolbar-action [] (let [show-actions (subscribe [:show-actions])] diff --git a/src/status_im/chat/sign_up.cljs b/src/status_im/chat/sign_up.cljs index ef855d0021..9633d94464 100644 --- a/src/status_im/chat/sign_up.cljs +++ b/src/status_im/chat/sign_up.cljs @@ -13,7 +13,8 @@ [status-im.constants :refer [text-content-type content-type-command content-type-command-request - content-type-status]])) + content-type-status]] + [status-im.i18n :refer [label]])) (defn send-console-msg [text] {:msg-id (random/id) @@ -32,7 +33,7 @@ (defn on-sync-contacts [] (dispatch [:received-msg {:msg-id (random/id) - :content (str "Your contacts have been synchronized") + :content (label :t/contacts-syncronized) :content-type text-content-type :outgoing false :from "console" @@ -70,8 +71,7 @@ {:msg-id msg-id :content (command-content :confirmation-code - (str "Thanks! We've sent you a text message with a confirmation " - "code. Please provide that code to confirm your phone number")) + (label :t/confirmation-code)) :content-type content-type-command-request :outgoing false :from "console" @@ -95,24 +95,21 @@ ;; TODO validate and save password (dispatch [:received-msg {:msg-id (random/id) - :content (str "OK great! Your password has been saved. Just to let you " - "know you can always change it in the Console by the way " - "it's me the Console nice to meet you!") + :content (label :t/password-saved) :content-type text-content-type :outgoing false :from "console" :to "me"}]) (dispatch [:received-msg {:msg-id (random/id) - :content (str "I'll generate a passphrase for you so you can restore your " - "access or log in from another device") + :content (label :t/generate-passphrase) :content-type text-content-type :outgoing false :from "console" :to "me"}]) (dispatch [:received-msg {:msg-id (random/id) - :content "Here's your passphrase:" + :content (label :t/passphrase) :content-type text-content-type :outgoing false :from "console" @@ -129,7 +126,7 @@ :to "me"}])) (dispatch [:received-msg {:msg-id "8" - :content "Make sure you had securely written it down" + :content (label :t/written-down) :content-type text-content-type :outgoing false :from "console" @@ -140,9 +137,7 @@ {:msg-id msg-id :content (command-content :phone - (str "Your phone number is also required to use the app. Type the " - "exclamation mark or hit the icon to open the command list " - "and choose the !phone command")) + (label :t/phone-number-required)) :content-type content-type-command-request :outgoing false :from "console" @@ -150,9 +145,7 @@ (def intro-status {:msg-id "intro-status" - :content (str "The brash businessman’s braggadocio " - "and public exchange with candidates " - "in the US presidential election") + :content (label :t/intro-status) :delivery-status "seen" :from "console" :chat-id "console" @@ -164,15 +157,14 @@ (dispatch [:received-msg intro-status]) (dispatch [:received-msg {:msg-id "intro-message1" - :content "Hello there! It's Status a Dapp browser in your phone." + :content (label :t/intro-message1) :content-type text-content-type :outgoing false :from "console" :to "me"}]) (dispatch [:received-msg {:msg-id "intro-message2" - :content (str "Status uses a highly secure key-pair authentication type " - "to provide you a reliable way to access your account") + :content (label :t/intro-message2) :content-type text-content-type :outgoing false :from "console" @@ -182,8 +174,7 @@ {:msg-id msg-id :content (command-content :keypair-password - (str "A key pair has been generated and saved to your device. " - "Create a password to secure your key")) + (label :t/keypair-generated)) :content-type content-type-command-request :outgoing false :from "console" diff --git a/src/status_im/chats_list/screen.cljs b/src/status_im/chats_list/screen.cljs index 980c21146e..a82849d7e6 100644 --- a/src/status_im/chats_list/screen.cljs +++ b/src/status_im/chats_list/screen.cljs @@ -16,13 +16,14 @@ toolbar-background2]] [status-im.components.toolbar :refer [toolbar]] [status-im.components.icons.ionicons :refer [icon]] + [status-im.i18n :refer [label]] [status-im.chats-list.styles :as st])) (defn chats-list-toolbar [] [toolbar {:nav-action {:image {:source {:uri :icon_hamburger} :style st/hamburger-icon} :handler open-drawer} - :title "Chats" + :title (label :t/chats) :background-color toolbar-background2 ;; TODO implement search :action {:image {:source {:uri :icon_search} @@ -43,13 +44,13 @@ :offsetY 16 :offsetX 16} [action-button-item - {:title "New Chat" + {:title (label :t/new-chat) :buttonColor :#9b59b6 :onPress #(dispatch [:navigate-to :contact-list])} [icon {:name :android-create :style st/create-icon}]] [action-button-item - {:title "New Group Chat" + {:title (label :t/new-group-chat) :buttonColor :#1abc9c :onPress #(dispatch [:show-group-new])} [icon {:name :person-stalker diff --git a/src/status_im/components/drawer/view.cljs b/src/status_im/components/drawer/view.cljs index 5101c6eaaa..1cd4ae43e8 100644 --- a/src/status_im/components/drawer/view.cljs +++ b/src/status_im/components/drawer/view.cljs @@ -11,7 +11,8 @@ drawer-layout-android touchable-opacity]] [status-im.resources :as res] - [status-im.components.drawer.styles :as st])) + [status-im.components.drawer.styles :as st] + [status-im.i18n :refer [label]])) (defonce drawer-atom (atom)) @@ -45,21 +46,21 @@ [text {:style st/name-text} @username]] [view st/menu-items-container - [menu-item {:name "Profile" + [menu-item {:name (label :t/profile) :handler #(dispatch [:navigate-to :my-profile])}] - [menu-item {:name "Settings" + [menu-item {:name (label :t/settings) :handler (fn [] ;; TODO not implemented )}] - [menu-item {:name "Discovery" + [menu-item {:name (label :t/discovery) :handler #(dispatch [:navigate-to :discovery])}] - [menu-item {:name "Contacts" + [menu-item {:name (label :t/contacts) :handler #(dispatch [:show-contacts navigator])}] - [menu-item {:name "Invite friends" + [menu-item {:name (label :t/invite-friends) :handler (fn [] ;; TODO not implemented )}] - [menu-item {:name "FAQ" + [menu-item {:name (label :t/faq) :handler (fn [])}]] [view st/switch-users-container [touchable-opacity {:onPress (fn [] @@ -67,7 +68,7 @@ ;; TODO not implemented )} [text {:style st/switch-users-text} - "Switch users"]]]]))) + (label :t/switch-users)]]]]))) (defn drawer-view [items] [drawer-layout-android {:drawerWidth 260 diff --git a/src/status_im/components/main_tabs.cljs b/src/status_im/components/main_tabs.cljs index b25ade7f4b..16fb5b074d 100644 --- a/src/status_im/components/main_tabs.cljs +++ b/src/status_im/components/main_tabs.cljs @@ -12,19 +12,19 @@ [status-im.components.tabs.tabs :refer [tabs]] [status-im.components.tabs.styles :as st] [status-im.components.styles :as common-st] - [status-im.utils.logging :as log])) + [status-im.i18n :refer [label]])) (def tab-list [{:view-id :chat-list - :title "Chats" + :title (label :t/chats) :screen chats-list :icon :icon_tab_chats} {:view-id :discovery - :title "Discover" + :title (label :t/discovery) :screen discovery :icon :icon_tab_discovery} {:view-id :contact-list - :title "Contacts" + :title (label :t/contacts) :screen contact-list :icon :icon_tab_contacts}]) diff --git a/src/status_im/components/toolbar.cljs b/src/status_im/components/toolbar.cljs index d7a164a624..3f21fc8a35 100644 --- a/src/status_im/components/toolbar.cljs +++ b/src/status_im/components/toolbar.cljs @@ -18,7 +18,7 @@ (defn toolbar [{:keys [title nav-action hide-nav? action custom-action background-color custom-content style]}] - (let [style (merge {:flexDirection "row" + (let [style (merge {:flexDirection :row :backgroundColor (or background-color toolbar-background1) :height 56 :elevation 2} style)] @@ -28,21 +28,21 @@ [touchable-highlight {:on-press (:handler nav-action)} [view {:width 56 :height 56 - :alignItems "center" - :justifyContent "center"} + :alignItems :center + :justifyContent :center} [image (:image nav-action)]]] [touchable-highlight {:on-press #(dispatch [:navigate-back])} [view {:width 56 :height 56} - [image {:source {:uri "icon_back"} + [image {:source {:uri :icon_back} :style {:marginTop 21 :marginLeft 23 :width 8 :height 14}}]]])) (or custom-content [view {:style {:flex 1 - :alignItems "center" - :justifyContent "center"}} + :alignItems :center + :justifyContent :center}} [text {:style {:marginTop -2.5 :color text1-color :fontSize 16 @@ -54,7 +54,7 @@ [view {:width 56 :height 56 - :alignItems "center" - :justifyContent "center"} + :alignItems :center + :justifyContent :center} [image (:image action)]]])])) diff --git a/src/status_im/contacts/screen.cljs b/src/status_im/contacts/screen.cljs index 3ed6af93bf..b8672807da 100644 --- a/src/status_im/contacts/screen.cljs +++ b/src/status_im/contacts/screen.cljs @@ -10,13 +10,14 @@ [status-im.components.styles :refer [toolbar-background2]] [status-im.components.toolbar :refer [toolbar]] [status-im.contacts.styles :as st] - [status-im.utils.listview :as lw])) + [status-im.utils.listview :as lw] + [status-im.i18n :refer [label]])) (defn render-row [row _ _] (list-item [contact-view row])) (defn contact-list-toolbar [] - [toolbar {:title "Contacts" + [toolbar {:title (label :t/contacts) :background-color toolbar-background2 :action {:image {:source {:uri :icon_search} :style st/search-icon} diff --git a/src/status_im/contacts/views/contact_inner.cljs b/src/status_im/contacts/views/contact_inner.cljs index 0c62dbd650..05502d793b 100644 --- a/src/status_im/contacts/views/contact_inner.cljs +++ b/src/status_im/contacts/views/contact_inner.cljs @@ -2,7 +2,8 @@ (:require [clojure.string :as s] [status-im.components.react :refer [view image text]] [status-im.resources :as res] - [status-im.contacts.styles :as st])) + [status-im.contacts.styles :as st] + [status-im.i18n :refer [label]])) (defn contact-photo [{:keys [photo-path]}] [view st/contact-photo-container @@ -27,4 +28,4 @@ (if (pos? (count name)) name ;; todo is this correct behaviour? - "Noname")]]]) + (label :t/no-name))]]]) diff --git a/src/status_im/discovery/screen.cljs b/src/status_im/discovery/screen.cljs index fc06443fa7..b7d8e37a7b 100644 --- a/src/status_im/discovery/screen.cljs +++ b/src/status_im/discovery/screen.cljs @@ -9,7 +9,8 @@ [status-im.components.toolbar :refer [toolbar]] [status-im.discovery.views.popular :refer [popular]] [status-im.discovery.views.recent :refer [discovery-recent]] - [status-im.discovery.styles :as st])) + [status-im.discovery.styles :as st] + [status-im.i18n :refer [label]])) (defn get-hashtags [status] (let [hashtags (map #(subs % 1) (re-seq #"#[^ !?,;:.]+" status))] @@ -20,13 +21,13 @@ (if show-search [text-input {:style st/discovery-search-input :autoFocus true - :placeholder "Type your search tags here" + :placeholder (label :t/search-tags) :onSubmitEditing (fn [e] (let [search (aget e "nativeEvent" "text") hashtags (get-hashtags search)] (dispatch [:broadcast-status search hashtags])))}] [view - [text {:style st/discovery-title} "Discover"]])]) + [text {:style st/discovery-title} (label :t/discovery)]])]) (defn toogle-search [current-value] (dispatch [:set ::show-search (not current-value)])) @@ -45,8 +46,8 @@ :handler #(toogle-search show-search)}}] [scroll-view st/scroll-view-container [view st/section-spacing - [text {:style st/discovery-subtitle} "Popular tags"]] + [text {:style st/discovery-subtitle} (label :t/popular-tags)]] [popular] [view st/section-spacing - [text {:style st/discovery-subtitle} "Recent"]] + [text {:style st/discovery-subtitle} (label :t/recent)]] [discovery-recent]]]) diff --git a/src/status_im/discovery/tag.cljs b/src/status_im/discovery/tag.cljs index a872b48000..aeda1f4d3c 100644 --- a/src/status_im/discovery/tag.cljs +++ b/src/status_im/discovery/tag.cljs @@ -1,7 +1,6 @@ (ns status-im.discovery.tag (:require [re-frame.core :refer [subscribe dispatch]] - [status-im.utils.logging :as log] [status-im.utils.listview :refer [to-datasource]] [status-im.components.react :refer [view text list-view list-item]] [status-im.components.toolbar :refer [toolbar]] @@ -23,7 +22,6 @@ (defn discovery-tag [] (let [tag (subscribe [:get :current-tag]) discoveries (subscribe [:get-discoveries-by-tag])] - (log/debug "Got discoveries: " @discoveries) (fn [] (let [items @discoveries datasource (to-datasource items)] @@ -31,7 +29,6 @@ [toolbar {:nav-action {:image {:source {:uri :icon_back} :style st/icon-back} :handler #(dispatch [:navigate-back])} - :title "Add Participants" :custom-content (title-content @tag) :action {:image {:source {:uri :icon_search} :style st/icon-search} diff --git a/src/status_im/discovery/views/popular.cljs b/src/status_im/discovery/views/popular.cljs index 65b47fdf05..9fbeb4f9fb 100644 --- a/src/status_im/discovery/views/popular.cljs +++ b/src/status_im/discovery/views/popular.cljs @@ -7,7 +7,8 @@ text]] [status-im.components.carousel.carousel :refer [carousel]] [status-im.discovery.styles :as st] - [status-im.discovery.views.popular-list :refer [discovery-popular-list]])) + [status-im.discovery.views.popular-list :refer [discovery-popular-list]] + [status-im.i18n :refer [label]])) (defn page-width [] (.-width (.get (.. js/React -Dimensions) "window"))) @@ -19,4 +20,4 @@ :sneak 20} (for [{:keys [name count]} popular-tags] [discovery-popular-list name count])] - [text "None"])) + [text (label :t/none)])) diff --git a/src/status_im/group_settings/screen.cljs b/src/status_im/group_settings/screen.cljs index 1c49c4f094..346b783912 100644 --- a/src/status_im/group_settings/screen.cljs +++ b/src/status_im/group_settings/screen.cljs @@ -14,7 +14,8 @@ [status-im.components.toolbar :refer [toolbar]] [status-im.components.chat-icon.screen :refer [chat-icon-view-action]] [status-im.group-settings.styles.group-settings :as st] - [status-im.group-settings.views.member :refer [member-view]])) + [status-im.group-settings.views.member :refer [member-view]] + [status-im.i18n :refer [label]])) (defn remove-member [] (dispatch [:remove-participants])) @@ -35,7 +36,7 @@ [text {:style st/modal-member-name} name] [touchable-highlight {:on-press remove-member} [text {:style st/modal-remove-text} - "Remove"]]]]])) + (label :t/remove)]]]]])) (defview chat-members [] [members [:current-chat-contacts]] @@ -75,13 +76,13 @@ [view st/modal-color-picker-inner-container [picker {:selectedValue new-color :onValueChange #(dispatch [:set :new-chat-color %])} - [picker-item {:label "Blue" :value "#7099e6"}] - [picker-item {:label "Purple" :value "#a187d5"}] - [picker-item {:label "Green" :value "green"}] - [picker-item {:label "Red" :value "red"}]] + [picker-item {:label (label :t/blue) :value "#7099e6"}] + [picker-item {:label (label :t/purple) :value "#a187d5"}] + [picker-item {:label (label :t/green) :value "green"}] + [picker-item {:label (label :t/red) :value "red"}]] [touchable-highlight {:on-press set-chat-color} [text {:style st/modal-color-picker-save-btn-text} - "Save"]]]]]) + (label :t/save)]]]]]) (defview chat-color-icon [] [chat-color [:chat :color]] @@ -92,11 +93,11 @@ (defn settings-view [] (let [settings [{:custom-icon [chat-color-icon] - :title "Change color" + :title (label :t/change-color) :handler show-chat-color-picker} ;; TODO not implemented: Notifications - (merge {:title "Notifications and sounds" - :subtitle "!not implemented" + (merge {:title (label :t/notifications-title) + :subtitle (label :t/not-implemented) :handler nil} (if true {:icon :notifications-on @@ -108,13 +109,13 @@ {:icon :close-gray :icon-style {:width 12 :height 12} - :title "Clear history" + :title (label :t/clear-history) ;; TODO show confirmation dialog? :handler #(dispatch [:clear-history])} {:icon :bin :icon-style {:width 12 :height 18} - :title "Delete and leave" + :title (label :t/delete-and-leave) ;; TODO show confirmation dialog? :handler #(dispatch [:leave-group-chat])}]] [view st/settings-container @@ -130,7 +131,7 @@ [chat-icon-view-action chat-id group-chat name color false]]) (defn new-group-toolbar [] - [toolbar {:title "Chat settings" + [toolbar {:title (label :t/chat-settings) :custom-action [chat-icon]}]) (defn focus [] @@ -147,7 +148,7 @@ new-name [:get :new-chat-name] focused? [:get ::name-input-focused]] [view - [text {:style st/chat-name-text} "Chat name"] + [text {:style st/chat-name-text} (label :t/chat-name)] [view (st/chat-name-value-container focused?) [text-input {:style st/chat-name-value :ref #(when (and % focused?) (.focus %)) @@ -161,7 +162,7 @@ [view [icon :ok-purple st/add-members-icon]]] [touchable-highlight {:style st/chat-name-btn-edit-container :on-press focus} - [text {:style st/chat-name-btn-edit-text} "Edit"]])]]) + [text {:style st/chat-name-btn-edit-text} (label :t/edit)]])]]) (defview group-settings [] [show-color-picker [:group-settings :show-color-picker]] @@ -169,16 +170,16 @@ [new-group-toolbar] [scroll-view st/body [chat-name] - [text {:style st/members-text} "Members"] + [text {:style st/members-text} (label :t/members-title)] [touchable-highlight {:on-press #(dispatch [:navigate-to :add-participants])} ;; TODO add participants view is not in design [view st/add-members-container [icon :add-gray st/add-members-icon] [text {:style st/add-members-text} - "Add members"]]] + (label :t/add-members)]]] [chat-members] [text {:style st/settings-text} - "Settings"] + (label :t/settings)] [settings-view]] (when show-color-picker [chat-color-picker]) diff --git a/src/status_im/group_settings/views/member.cljs b/src/status_im/group_settings/views/member.cljs index 240d6a09c8..c5292daa36 100644 --- a/src/status_im/group_settings/views/member.cljs +++ b/src/status_im/group_settings/views/member.cljs @@ -7,7 +7,8 @@ icon touchable-highlight]] [status-im.resources :as res] - [status-im.group-settings.styles.member :as st])) + [status-im.group-settings.styles.member :as st] + [status-im.i18n :refer [label]])) (defn contact-photo [{:keys [photo-path]}] [view st/contact-photo-container @@ -32,7 +33,7 @@ (if (pos? (count name)) name ;; todo is this correct behaviour? - "Noname")] + (label :t/no-name))] ;; TODO implement :role property for group chat contact (when role [text {:style st/role-text} diff --git a/src/status_im/i18n.cljs b/src/status_im/i18n.cljs new file mode 100644 index 0000000000..9abde5c46e --- /dev/null +++ b/src/status_im/i18n.cljs @@ -0,0 +1,23 @@ +(ns status-im.i18n + (:require + [status-im.translations.en :as en])) + +(set! js/window.I18n (js/require "react-native-i18n")) +(set! (.-fallbacks js/I18n) true) +(set! (.-defaultSeparator js/I18n) "/") + +(set! (.-translations js.I18n) (clj->js {:en en/translations})) + +(defn label [path & options] + (.t js/I18n (name path) (clj->js options))) + +(comment + (defn deep-merge [& maps] + (if (every? map? maps) + (apply merge-with deep-merge maps) + (last maps))) + + (defn add-translations [new-translations] + (let [translations (.-translations js/I18n)] + (set! (.-translations js/I18n) (clj->js (deep-merge (js->clj translations) new-translations))))) + ) \ No newline at end of file diff --git a/src/status_im/models/commands.cljs b/src/status_im/models/commands.cljs index 4ade2ed196..a9ba2ffd26 100644 --- a/src/status_im/models/commands.cljs +++ b/src/status_im/models/commands.cljs @@ -3,32 +3,33 @@ [clojure.walk :refer [stringify-keys keywordize-keys]] [re-frame.core :refer [subscribe dispatch]] [status-im.db :as db] - [status-im.components.styles :refer [color-blue color-dark-mint]])) + [status-im.components.styles :refer [color-blue color-dark-mint]] + [status-im.i18n :refer [label]])) ;; todo delete (def commands [{:command :money :text "!money" - :description "Send money" + :description (label :t/money-command-description) :color color-dark-mint :request-icon {:uri "icon_lock_white"} :icon {:uri "icon_lock_gray"} :suggestion true} {:command :location :text "!location" - :description "Send location" + :description (label :t/location-command-description) :color "#9a5dcf" :suggestion true} {:command :phone :text "!phone" - :description "Send phone number" + :description (label :t/phone-command-description) :color color-dark-mint - :request-text "Phone number request" + :request-text (label :t/phone-request-text) :suggestion true :handler #(dispatch [:sign-up %])} {:command :confirmation-code :text "!confirmationCode" - :description "Send confirmation code" - :request-text "Confirmation code request" + :description (label :t/confirmation-code-command-description) + :request-text (label :t/confirmation-code-request-text) :color color-blue :request-icon {:uri "icon_lock_white"} :icon {:uri "icon_lock_gray"} @@ -36,17 +37,17 @@ :handler #(dispatch [:sign-up-confirm %])} {:command :send :text "!send" - :description "Send location" + :description (label :t/send-command-description) :color "#9a5dcf" :suggestion true} {:command :request :text "!request" - :description "Send request" + :description (label :t/request-command-description) :color "#48ba30" :suggestion true} {:command :keypair-password - :text "!keypairPassword" - :description "" + :text "!keypair-password" + :description (label :t/keypair-password-command-description) :color color-blue :request-icon {:uri "icon_lock_white"} :icon {:uri "icon_lock_gray"} @@ -54,7 +55,7 @@ :handler #(dispatch [:save-password %])} {:command :help :text "!help" - :description "Help" + :description (label :t/help-command-description) :color "#9a5dcf" :suggestion true}]) diff --git a/src/status_im/new_group/screen.cljs b/src/status_im/new_group/screen.cljs index a620959d50..4b266486c6 100644 --- a/src/status_im/new_group/screen.cljs +++ b/src/status_im/new_group/screen.cljs @@ -14,14 +14,15 @@ [status-im.components.toolbar :refer [toolbar]] [status-im.utils.listview :refer [to-datasource]] [status-im.new-group.views.contact :refer [new-group-contact]] - [status-im.new-group.styles :as st])) + [status-im.new-group.styles :as st] + [status-im.i18n :refer [label]])) (defview new-group-toolbar [] [group-name [:get ::group-name] creation-disabled? [:get :disable-group-creation]] [toolbar - {:title "New group chat" + {:title (label :t/new-group-chat) :action {:image {:source res/v ;; {:uri "icon_search"} :style st/toolbar-icon} :handler (when-not creation-disabled? @@ -33,7 +34,7 @@ {:underlineColorAndroid color-purple :style st/group-name-input :autoFocus true - :placeholder "Group Name" + :placeholder (label :t/group-name) :onChangeText #(dispatch [:set ::group-name %])} group-name]) @@ -42,13 +43,13 @@ [view st/new-group-container [new-group-toolbar] [view st/chat-name-container - [text {:style st/chat-name-text} "Chat name"] + [text {:style st/chat-name-text} (label :t/chat-name)] [group-name-input] - [text {:style st/members-text} "Members"] + [text {:style st/members-text} (label :t/members-title)] [touchable-highlight {:on-press (fn [])} [view st/add-container [icon :add_gray st/add-icon] - [text {:style st/add-text} "Add members"]]] + [text {:style st/add-text} (label :t/add-members)]]] [list-view {:dataSource (to-datasource contacts) :renderRow (fn [row _ _] diff --git a/src/status_im/participants/views/add.cljs b/src/status_im/participants/views/add.cljs index 5bab93ea1c..e708b9a7c2 100644 --- a/src/status_im/participants/views/add.cljs +++ b/src/status_im/participants/views/add.cljs @@ -7,11 +7,12 @@ [status-im.utils.listview :refer [to-datasource]] [status-im.participants.views.contact :refer [participant-contact]] [reagent.core :as r] - [status-im.participants.styles :as st])) + [status-im.participants.styles :as st] + [status-im.i18n :refer [label]])) (defn new-participants-toolbar [] [toolbar - {:title "Add Participants" + {:title (label :t/add-participants) :action {:image {:source res/v ;; {:uri "icon_search"} :style st/new-participant-image} :handler #(do (dispatch [:add-new-participants]) diff --git a/src/status_im/participants/views/remove.cljs b/src/status_im/participants/views/remove.cljs index e7b8103ffe..6469371a3f 100644 --- a/src/status_im/participants/views/remove.cljs +++ b/src/status_im/participants/views/remove.cljs @@ -10,11 +10,12 @@ [status-im.participants.views.contact :refer [participant-contact]] [reagent.core :as r] - [status-im.participants.styles :as st])) + [status-im.participants.styles :as st] + [status-im.i18n :refer [label]])) (defn remove-participants-toolbar [] [toolbar - {:title "Remove Participants" + {:title (label :t/remove-participants) :action {:handler #(do (dispatch [:remove-participants]) (dispatch [:navigate-back])) :image {:source res/trash-icon ;; {:uri "icon_search"} diff --git a/src/status_im/profile/screen.cljs b/src/status_im/profile/screen.cljs index 83470681dc..f2de5dcb41 100644 --- a/src/status_im/profile/screen.cljs +++ b/src/status_im/profile/screen.cljs @@ -10,7 +10,8 @@ touchable-opacity]] [status-im.components.chat-icon.screen :refer [profile-icon my-profile-icon]] - [status-im.profile.styles :as st])) + [status-im.profile.styles :as st] + [status-im.i18n :refer [label]])) (defn profile-property-view [{:keys [name value]}] [view st/profile-property-view-container @@ -34,29 +35,29 @@ [profile-icon]] [text {:style st/user-name} name] ;; TODO stub data - [text {:style st/status} "!not implemented"] + [text {:style st/status} (label :t/not-implemented)] [view st/btns-container [touchable-highlight {:onPress #(message-user whisper-identity)} [view st/message-btn - [text {:style st/message-btn-text} "Message"]]] + [text {:style st/message-btn-text} (label :t/message)]]] [touchable-highlight {:onPress (fn [] ;; TODO not implemented )} [view st/more-btn [icon :more_vertical_blue st/more-btn-image]]]]] [view st/profile-properties-container - [profile-property-view {:name "Username" + [profile-property-view {:name (label :t/username) :value name}] - [profile-property-view {:name "Phone number" + [profile-property-view {:name (label :t/phone-number) :value phone-number}] ;; TODO stub data - [profile-property-view {:name "Email" - :value "!not implemented"}] + [profile-property-view {:name (label :t/email) + :value (label :t/not-implemented)}] [view st/report-user-container [touchable-highlight {:on-press (fn [] ;; TODO not implemented )} - [text {:style st/report-user-text} "REPORT USER"]]]]]) + [text {:style st/report-user-text} (label :t/report-user)]]]]]) (defview my-profile [] [username [:get :username] @@ -81,9 +82,9 @@ [text {:style st/user-name} username] [text {:style st/status} status]] [view st/profile-properties-container - [profile-property-view {:name "Username" + [profile-property-view {:name (label :t/username) :value username}] - [profile-property-view {:name "Phone number" + [profile-property-view {:name (label :t/phone-number) :value phone-number}] - [profile-property-view {:name "Email" + [profile-property-view {:name (label :t/email) :value email}]]]) diff --git a/src/status_im/protocol/handlers.cljs b/src/status_im/protocol/handlers.cljs index 4b51c9ec65..a9b94e5541 100644 --- a/src/status_im/protocol/handlers.cljs +++ b/src/status_im/protocol/handlers.cljs @@ -12,7 +12,8 @@ set-initialized]] [status-im.constants :refer [text-content-type]] [status-im.models.messages :as messages] - [status-im.models.chats :as chats])) + [status-im.models.chats :as chats] + [status-im.i18n :refer [label]])) (register-handler :initialize-protocol (u/side-effect! @@ -35,35 +36,35 @@ (let [contact-name (:name (contacts/contact-by-identity from))] (messages/save-message chat-id {:from "system" :msg-id (str msg-id "_" from) - :content (str (or contact-name from) " received chat invitation") + :content (str (or contact-name from) " " (label :t/received-invitation)) :content-type text-content-type}))) (defn participant-invited-to-group-msg [chat-id identity from msg-id] (let [inviter-name (:name (contacts/contact-by-identity from)) invitee-name (if (= identity (api/my-identity)) - "You" + (label :t/You) (:name (contacts/contact-by-identity identity)))] (messages/save-message chat-id {:from "system" :msg-id msg-id - :content (str (or inviter-name from) " invited " (or invitee-name identity)) + :content (str (or inviter-name from) " " (label :t/invited) " " (or invitee-name identity)) :content-type text-content-type}))) (defn participant-removed-from-group-msg [chat-id identity from msg-id] (let [remover-name (:name (contacts/contact-by-identity from)) removed-name (:name (contacts/contact-by-identity identity))] - (->> (str (or remover-name from) " removed " (or removed-name identity)) + (->> (str (or remover-name from) " " (label :t/removed) " " (or removed-name identity)) (system-message msg-id) (messages/save-message chat-id)))) (defn you-removed-from-group-msg [chat-id from msg-id] (let [remover-name (:name (contacts/contact-by-identity from))] - (->> (str (or remover-name from) " removed you from group chat") + (->> (str (or remover-name from) " " (label :t/removed-from-chat)) (system-message msg-id) (messages/save-message chat-id)))) (defn participant-left-group-msg [chat-id from msg-id] (let [left-name (:name (contacts/contact-by-identity from))] - (->> (str (or left-name from) " left") + (->> (str (or left-name from) " " (label :t/left)) (system-message msg-id) (messages/save-message chat-id)))) diff --git a/src/status_im/translations/en.cljs b/src/status_im/translations/en.cljs new file mode 100644 index 0000000000..be71f9037b --- /dev/null +++ b/src/status_im/translations/en.cljs @@ -0,0 +1,115 @@ +(ns status-im.translations.en) + +(def translations + { + ;common + :members-title "Members" + :not-implemented "!not implemented" + :chat-name "Chat name" + :notifications-title "Notifications and sounds" + + ;drawer + :invite-friends "Invite friends" + :faq "FAQ" + :switch-users "Switch users" + + ;chat + :is-typing "is typing" + :and-you "and you" + :search-chat "Search chat" + :members {:one "1 member, 1 active" + :other "{{count}} members, {{count}} active"} + :last-active "Active a minute ago" + + ;profile + :profile "Profile" + :report-user "REPORT USER" + :message "Message" + :username "Username" + :phone-number "Phone number" + :email "Email" + + ;sign-up + :contacts-syncronized "Your contacts have been synchronized" + :confirmation-code (str "Thanks! We've sent you a text message with a confirmation " + "code. Please provide that code to confirm your phone number") + :password-saved (str "OK great! Your password has been saved. Just to let you " + "know you can always change it in the Console by the way " + "it's me the Console nice to meet you!") + :generate-passphrase (str "I'll generate a passphrase for you so you can restore your " + "access or log in from another device") + :passphrase "Here's your passphrase:" + :written-down "Make sure you had securely written it down" + :phone-number-required (str "Your phone number is also required to use the app. Type the " + "exclamation mark or hit the icon to open the command list " + "and choose the !phone command") + :intro-status (str "The brash businessman’s braggadocio " + "and public exchange with candidates " + "in the US presidential election") + :intro-message1 "Hello there! It's Status a Dapp browser in your phone." + :intro-message2 (str "Status1 uses a highly secure key-pair authentication type " + "to provide you a reliable way to access your account") + :keypair-generated (str "A key pair has been generated and saved to your device. " + "Create a password to secure your key") + + ;chats + :chats "Chats" + :new-chat "New Chat" + :new-group-chat "New Group Chat" + + ;discover + :discovery "Discovery" + :none "None" + :search-tags "Type your search tags here" + :popular-tags "Popular tags" + :recent "Recent" + + ;settings + :settings "Settings" + + ;contacts + :contacts "Contacts" + :no-name "Noname" + + ;group-settings + :remove "Remove" + :save "Save" + :change-color "Change color" + :clear-history "Clear history" + :delete-and-leave "Delete and leave" + :chat-settings "Chat settings" + :edit "Edit" + :add-members "Add Members" + :blue "Blue" + :purple "Purple" + :green "Green" + :red "Red" + + ;commands + :money-command-description "Send money" + :location-command-description "Send location" + :phone-command-description "Send phone number" + :phone-request-text "Phone number request" + :confirmation-code-coomand-description "Send confirmation code" + :confirmation-code-request-text "Confirmation code request" + :send-command-description "Send location" + :request-command-description "Send request" + :keypair-password-command-description "" + :help-command-description "Help" + + ;new-group + :group-name "Group Name" + + ;participants + :add-participants "Add Participants" + :remove-participants "Remove Participants" + + ;protocol + :received-invitation "received chat invitation" + :removed-from-chat "removed you from group chat" + :left "left" + :invited "invited" + :removed "removed" + :You "You" + + }) \ No newline at end of file