From d4d6bf8e7a399517837b14b4bea3b4e1cb36fb19 Mon Sep 17 00:00:00 2001 From: Alex Megalokonomos Date: Mon, 3 Sep 2018 23:55:22 +0300 Subject: [PATCH 01/35] i18n Localisation work --- package-lock.json | 46 +++++++++++++++++++++++++-- package.json | 3 ++ src/components/create.vue | 2 +- src/components/dashboard.vue | 4 ++- src/components/header-guest.vue | 7 +++-- src/config/i18n.js | 9 ++++++ src/index.html | 27 +++++++++++++--- src/store/index.js | 4 ++- src/store/modules/SettingsStore.js | 49 +++++++++++++++++++++++++++++ src/translations/common/en.json | 36 +++++++++++++++++++++ src/translations/operations/en.json | 20 ++++++++++++ 11 files changed, 194 insertions(+), 13 deletions(-) create mode 100644 src/config/i18n.js create mode 100644 src/store/modules/SettingsStore.js create mode 100644 src/translations/common/en.json create mode 100644 src/translations/operations/en.json diff --git a/package-lock.json b/package-lock.json index 0d57ba8f..9df31401 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,6 +36,14 @@ } } }, + "@panter/vue-i18next": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@panter/vue-i18next/-/vue-i18next-0.12.0.tgz", + "integrity": "sha1-SHXDjUW36kzk6HbWCFQWEnuGa0Y=", + "requires": { + "deepmerge": "2.1.1" + } + }, "@paulcbetts/mime-db": { "version": "1.22.4", "resolved": "https://registry.npmjs.org/@paulcbetts/mime-db/-/mime-db-1.22.4.tgz", @@ -2273,6 +2281,11 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "deepmerge": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-2.1.1.tgz", + "integrity": "sha512-urQxA1smbLZ2cBbXbaYObM1dJ82aJ2H57A1C/Kklfh/ZN1bgH4G/n5KWhdNfOK11W98gqZfyYj7W4frJJRwA2w==" + }, "defaults": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", @@ -3624,8 +3637,7 @@ "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, "estraverse": { "version": "4.2.0", @@ -4340,6 +4352,35 @@ } } }, + "i18next": { + "version": "11.6.0", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-11.6.0.tgz", + "integrity": "sha512-+eOdu1laoPX8l3zuaEFpf0MPYqAyKeX46WEjRkpPLp0TcijP3ww6NrDCPcRwX3yKB69R+ggiLvLGzCm8ALaVXQ==" + }, + "i18next-node-fs-backend": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/i18next-node-fs-backend/-/i18next-node-fs-backend-2.0.0.tgz", + "integrity": "sha512-02rQSL+FsLcQm8rCFZbnLufNNjFyECSSnZkVgajDSbtHqVXdQ3COqgSM9u1UH3/RH3i4tjVcsfLDtUFaMxxmug==", + "requires": { + "js-yaml": "3.12.0", + "json5": "2.0.0" + }, + "dependencies": { + "json5": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.0.0.tgz", + "integrity": "sha512-0EdQvHuLm7yJ7lyG5dp7Q3X2ku++BG5ZHaJ5FTnaXpKqDrw4pMxel5Bt3oAYMthnrthFBdnZ1FcsXTPyrQlV0w==", + "requires": { + "minimist": "1.2.0" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + } + } + }, "iconv-lite": { "version": "0.4.23", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", @@ -4790,7 +4831,6 @@ "version": "3.12.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", - "dev": true, "requires": { "argparse": "1.0.10", "esprima": "4.0.1" diff --git a/package.json b/package.json index 4a65b09b..bd85278c 100644 --- a/package.json +++ b/package.json @@ -47,11 +47,14 @@ } }, "dependencies": { + "@panter/vue-i18next": "^0.12.0", "bitsharesjs": "^1.8.0", "bootstrap-vue": "^2.0.0-rc.11", "electron-compile": "^6.4.3", "electron-devtools-installer": "^2.2.4", "electron-squirrel-startup": "^1.0.0", + "i18next": "^11.6.0", + "i18next-node-fs-backend": "^2.0.0", "secure-ls": "^1.2.1", "socket.io": "^2.1.1", "uuid": "^3.3.2", diff --git a/src/components/create.vue b/src/components/create.vue index 3860e94e..542903f8 100644 --- a/src/components/create.vue +++ b/src/components/create.vue @@ -27,7 +27,7 @@ v-model="includeOwner" value="1" unchecked-value="0" class="mb-3"> - Include Owner Key + Include Owner Key?
diff --git a/src/components/dashboard.vue b/src/components/dashboard.vue index 0e11137a..1400feec 100644 --- a/src/components/dashboard.vue +++ b/src/components/dashboard.vue @@ -3,7 +3,7 @@
@@ -67,6 +67,7 @@ import { export default { name: "dashboard", + i18nOptions: { namespaces: ["common","operations"] }, data() { return { text: "", @@ -89,6 +90,7 @@ export default { this.$refs.loaderAnimModal.show(); BeetServer.initialize(this); BeetServer.open(); + }, methods: { getBalances: async function() { diff --git a/src/components/header-guest.vue b/src/components/header-guest.vue index 9def479d..201aa391 100644 --- a/src/components/header-guest.vue +++ b/src/components/header-guest.vue @@ -1,13 +1,14 @@ diff --git a/src/store/index.js b/src/store/index.js index 0a4c0c3b..a0e64b54 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,12 +1,14 @@ import Vue from 'vue/dist/vue.js'; import Vuex from 'vuex'; import BeetStore from './modules/BeetStore.js'; +import SettingsStore from './modules/SettingsStore.js'; Vue.use(Vuex); const store = new Vuex.Store({ modules: { - BeetStore + BeetStore, + SettingsStore } }); diff --git a/src/store/modules/SettingsStore.js b/src/store/modules/SettingsStore.js new file mode 100644 index 00000000..69043ce6 --- /dev/null +++ b/src/store/modules/SettingsStore.js @@ -0,0 +1,49 @@ +import Vue from 'vue/dist/vue.js'; +const LOAD_SETTINGS = 'LOAD_SETTINGS'; + + +const mutations = { + [LOAD_SETTINGS](state, settings) { + Vue.set(state, 'settings', settings); + } +}; + +const actions = { + loadSettings({ + commit + }) { + return new Promise((resolve, reject) => { + try { + let settings=localStorage.getItem("settings"); + if (settings && settings.length > 0) { + commit(LOAD_SETTINGS, settings); + }else{ + localStorage.setItem("settings", JSON.stringify(initialState.settings)); + } + resolve(); + } catch (e) { + reject(); + } + }); + } +} + + +const getters = { +}; + + +const initialState = { + 'settings': { + 'locale': 'en', + 'selected_node': 'wss://bts-seoul.clockwork.gr' + } +}; + +export default { + namespaced: true, + state: initialState, + actions, + mutations, + getters, +}; \ No newline at end of file diff --git a/src/translations/common/en.json b/src/translations/common/en.json new file mode 100644 index 00000000..fcf00ec7 --- /dev/null +++ b/src/translations/common/en.json @@ -0,0 +1,36 @@ +{ + "app_name": "Beet", + "slogan": "The BitShares companion", + "welcome": "Welcome to Beet!", + "no_wallet": "There is no wallet stored in this computer.", + "start_cta": "Get Started", + "select_wallet": "Select Wallet:", + "password_placeholder": "Password", + "unlock_cta": "Unlock", + "create_cta": "Create a new Wallet", + "step_counter": "Step {{step_no}}", + "friendly_cta": "Set a friendly name for your new wallet:", + "walletname_placeholder": "Wallet Name", + "cancel_btn": "Cancel", + "next_btn": "Next", + "back_btn": "Back", + "account_name": "{{chain}} Account Name", + "keys_cta": "Please enter the private keys for your account below:", + "active_authority": "Active Authority", + "owner_authority": "Owner Authority", + "memo_authority": "Memo Authority", + "active_authority_placceholder": "Active Private Key", + "owner_authority_placeholder": "Owner Private Key", + "memo_authority_placeholder": "Memo Private Key", + "include_owner_check": "Include Owner Key?", + "password_cta": "Set a password for this wallet:", + "confirm_placeholder": "Confirm password", + "empty_wallet_error": "Can not create a wallet with an empty name.", + "duplicate_wallet_error": "A wallet with this name already exists.", + "missing_account_error": "You must specify your {{chain}} account name.", + "invalid_key_error": "Invalid Private key format.", + "unverified_account_error": "Could not verify keys for account name provided. Please check.", + "confirm_pass_error": "Passwords do not match.", + "balances_lbl": "Balances", + "node_lbl": "Node" +} \ No newline at end of file diff --git a/src/translations/operations/en.json b/src/translations/operations/en.json new file mode 100644 index 00000000..e7f90f55 --- /dev/null +++ b/src/translations/operations/en.json @@ -0,0 +1,20 @@ +{ + "account_id": { + "request": "The page/app {{- origin}} is requesting to access your account ID.", + "request_cta": "Do you want to allow access?", + "accept_btn": "Allow", + "reject_btn": "Deny" + }, + "rawsig": { + "request": "The page/app {{- origin}} has submitted the following transaction.", + "request_cta": "Do you want to execute it?", + "accept_btn": "Sign & Broadcast", + "reject_btn": "Ignore" + }, + "vote": { + "request": "The page/app {{- origin}} wants you to vote for the following {{entity}}", + "request_cta": "", + "accept_btn": "Approve", + "reject_btn": "Ignore" + } +} \ No newline at end of file From a17ff9271949c8a7d71317cdb3f7190e4d5ca59d Mon Sep 17 00:00:00 2001 From: Alex Megalokonomos Date: Tue, 4 Sep 2018 00:20:06 +0300 Subject: [PATCH 02/35] Localised start.vue --- src/components/start.vue | 14 +++++++------- src/config/i18n.js | 9 --------- 2 files changed, 7 insertions(+), 16 deletions(-) delete mode 100644 src/config/i18n.js diff --git a/src/components/start.vue b/src/components/start.vue index 2c91bf9e..2e4182f5 100644 --- a/src/components/start.vue +++ b/src/components/start.vue @@ -1,16 +1,16 @@