Skip to content

Open source personal finance application

Add languages in user interface. Now available Russian and English.

Ilya Komichev5a397304500f
diff --git a/package.json b/package.json
index 1719a48e..2e06f433 100644
--- a/package.json
+++ b/package.json
@@ -30,6 +30,7 @@
"swiper": "^4.3.5",
"vue": "^2.5.17",
"vue-focus": "^2.1.0",
+ "vue-lang": "^0.2.5",
"vue-notification": "^1.3.13",
"vuejs-datepicker": "^1.5.3",
"vuex": "^3.0.1"
diff --git a/src/components/app/App.vue b/src/components/app/App.vue
index c672dd87..a3d9b6fb 100644
--- a/src/components/app/App.vue
+++ b/src/components/app/App.vue
@@ -21,11 +21,22 @@ export default {
computed: {
layoutStyles () {
return { height: `${this.$store.state.ui.height}px` }
+ },
+ lang () {
+ return this.$store.state.lang.lang
+ }
+ },
+
+ watch: {
+ lang (newValue, oldValue) {
+ if (newValue !== oldValue) {
+ this.$setLang(newValue)
+ }
}
},
- created () {
- this.$store.dispatch('initApp')
+ async created () {
+ await this.$store.dispatch('initApp')
this.handleWindowHistory()
this.getPageDimensions()
window.addEventListener('resize', debounce(this.getPageDimensions, 1000))
diff --git a/src/components/app/store/actions.js b/src/components/app/store/actions.js
index 9331be18..0b395dac 100644
--- a/src/components/app/store/actions.js
+++ b/src/components/app/store/actions.js
@@ -18,6 +18,7 @@ export default {
await dispatch('initCategories')
await dispatch('initWallets')
await dispatch('initTrns')
+ await dispatch('initDbLang')
} catch (e) {
console.error(e)
}
@@ -29,6 +30,7 @@ export default {
async initAppFromCache ({ commit, dispatch }) {
dispatch('initStat')
+ dispatch('initLocalLang')
dispatch('initUi')
dispatch('initChart')
diff --git a/src/components/lang/LangDropdown.vue b/src/components/lang/LangDropdown.vue
new file mode 100644
index 00000000..dce8b7f1
--- /dev/null
+++ b/src/components/lang/LangDropdown.vue
@@ -0,0 +1,64 @@
+<script>
+import ContextMenu from '@/components/shared/contextMenu/ContextMenu'
+import ContextMenuItem from '@/components/shared/contextMenu/ContextMenuItem'
+import Dropdown from '@/components/shared/dropdown/Dropdown'
+
+export default {
+ components: {
+ ContextMenu,
+ ContextMenuItem,
+ Dropdown
+ },
+
+ data () {
+ return {
+ visibleDropdown: false
+ }
+ },
+
+ computed: {
+ currentLanguageName () {
+ switch (this.$store.state.lang.lang) {
+ case 'ru':
+ return '🇷🇺 Russian - Русский'
+ default:
+ return '🇺🇸 English - Английский'
+ }
+ }
+ },
+
+ methods: {
+ changeLang (lang) {
+ this.visibleDropdown = false
+ setTimeout(() => {
+ this.$store.dispatch('setLang', lang)
+ this.$setLang(lang)
+ }, 100)
+ }
+ }
+}
+</script>
+
+<template lang="pug">
+div
+ ContextMenu(
+ :position="{ left: true, top: true }"
+ :visible="visibleDropdown"
+ v-on:onClickOpener="visibleDropdown = !visibleDropdown")
+ template(slot="opener")
+ Dropdown(
+ :active="visibleDropdown"
+ :title="currentLanguageName")
+ template(slot="content")
+ ContextMenuItem(
+ title="🇷🇺 Russian - Русский (Не полный)"
+ v-on:onClick="changeLang('ru')")
+ .context-menu-sep
+ ContextMenuItem(
+ title="🇺🇸 English - Английский"
+ v-on:onClick="changeLang('en')")
+</template>
+
+<style lang="stylus" scoped>
+
+</style>
diff --git a/src/components/lang/store/actions.js b/src/components/lang/store/actions.js
new file mode 100644
index 00000000..0d2a06d7
--- /dev/null
+++ b/src/components/lang/store/actions.js
@@ -0,0 +1,26 @@
+import localforage from 'localforage'
+import { db } from '@/firebase'
+
+export default {
+ setLang ({ rootState, commit }, lang) {
+ const uid = rootState.user.user.uid
+ db.ref(`users/${uid}/settings/lang`).set(lang)
+ commit('setLang', lang)
+ localforage.setItem('finapp.lang', lang)
+ },
+
+ async initLocalLang ({ rootState, commit }) {
+ const localLang = await localforage.getItem('finapp.lang')
+ if (localLang) commit('setLang', localLang)
+ },
+
+ async initDbLang ({ rootState, commit }) {
+ const uid = rootState.user.user.uid
+ const dbLang = await db.ref(`users/${uid}/settings/lang`).once('value')
+ const lang = dbLang.val()
+ if (lang && lang !== rootState.lang.lang) {
+ commit('setLang', lang)
+ localforage.setItem('finapp.lang', lang)
+ }
+ }
+}
diff --git a/src/components/lang/store/index.js b/src/components/lang/store/index.js
new file mode 100644
index 00000000..beb1b409
--- /dev/null
+++ b/src/components/lang/store/index.js
@@ -0,0 +1,12 @@
+import actions from './actions'
+import mutations from './mutations'
+
+const state = {
+ lang: 'en'
+}
+
+export default {
+ state,
+ actions,
+ mutations
+}
diff --git a/src/components/lang/store/mutations.js b/src/components/lang/store/mutations.js
new file mode 100644
index 00000000..3a7d40dd
--- /dev/null
+++ b/src/components/lang/store/mutations.js
@@ -0,0 +1,5 @@
+export default {
+ setLang (state, lang) {
+ state.lang = lang
+ }
+}
diff --git a/src/components/layout/LayoutMobileMenu.vue b/src/components/layout/LayoutMobileMenu.vue
index 369b0ceb..eab6597e 100644
--- a/src/components/layout/LayoutMobileMenu.vue
+++ b/src/components/layout/LayoutMobileMenu.vue
@@ -16,33 +16,35 @@ export default {
data () {
return {
- visibleCustomizeMenu: false,
- menu: [{
+ visibleCustomizeMenu: false
+ }
+ },
+
+ computed: {
+ activeTab () {
+ return this.$store.state.ui.activeTab
+ },
+ menu () {
+ return [{
icon: 'mdi mdi-credit-card-multiple',
id: 'wallets',
- name: 'Wallets'
+ name: this.$lang.wallets.title
}, {
icon: 'mdi mdi-chart-bubble',
id: 'categories',
- name: 'Cats'
+ name: this.$lang.categories.shortTitle
}, {
icon: 'mdi mdi-poll',
id: 'stat',
- name: 'Stat'
+ name: this.$lang.stat.shortTitle
}, {
icon: 'mdi mdi-history',
id: 'history',
- name: 'Trns'
+ name: this.$lang.trns.shortTitle
}]
}
},
- computed: {
- activeTab () {
- return this.$store.state.ui.activeTab
- }
- },
-
methods: {
getClassName (tab) {
if (this.$store.state.ui.activeTab === 'stat') {
@@ -85,16 +87,16 @@ export default {
.create-btn(v-show="activeTab === 'categories'")
Button(
className="_inline _small"
- title="New category"
+ :title="$lang.categories.new"
v-on:onClick="$store.dispatch('setActiveTab', 'createCategory')")
.create-btn(v-show="activeTab === 'wallets'")
Button(
className="_inline _small"
- title="New wallet"
+ :title="$lang.wallets.new"
v-on:onClick="$store.dispatch('setActiveTab', 'createWallet')")
- .customize(v-show="activeTab !== 'stat' && activeTab !== 'trns'")
+ .customize(v-show="activeTab === 'wallets' || activeTab === 'categories'")
ContextMenu(
:position="{ right: true, bottom: true }"
:visible="visibleCustomizeMenu"
@@ -103,11 +105,11 @@ export default {
Dropdown(
:active="visibleCustomizeMenu"
icon="mdi mdi-tune"
- title="Options")
+ :title="$lang.settings.options")
template(slot="content")
ContextMenuItem(
icon="mdi mdi-settings"
- title="Go to settings"
+ :title="$lang.settings.open"
v-on:onClick="$store.dispatch('setActiveTab', 'settings')"
v-on:onClose="visibleCustomizeMenu = !visibleCustomizeMenu")
.context-menu-sep
@@ -133,7 +135,7 @@ export default {
.menu__item._hightlight(@click="$store.dispatch('openTrnForm', { action: 'create' })")
.menu__item__icon: .mdi.mdi-library-plus
- .menu__item__text Create
+ .menu__item__text {{ this.$lang.create.title }}
</template>
<style lang="stylus" scoped>
diff --git a/src/components/layout/PeriodNavMobile.vue b/src/components/layout/PeriodNavMobile.vue
index 68c52fc6..f3aab57b 100644
--- a/src/components/layout/PeriodNavMobile.vue
+++ b/src/components/layout/PeriodNavMobile.vue
@@ -41,31 +41,31 @@ export default {
template(slot="content")
ContextMenuItem(
icon="mdi mdi-weather-sunset-up"
- title="Day"
+ :title="$lang.dates.day.simple"
:selected="$store.state.filter.period === 'day'"
v-on:onClick="$store.dispatch('setPeriod', 'day')"
v-on:onClose="visiblePeriodMenu = !visiblePeriodMenu")
ContextMenuItem(
icon="mdi mdi-calendar-week"
- title="Week"
+ :title="$lang.dates.week.simple"
:selected="$store.state.filter.period === 'week'"
v-on:onClick="$store.dispatch('setPeriod', 'week')"
v-on:onClose="visiblePeriodMenu = !visiblePeriodMenu")
ContextMenuItem(
icon="mdi mdi-calendar"
- title="Month"
+ :title="$lang.dates.month.simple"
:selected="$store.state.filter.period === 'month'"
v-on:onClick="$store.dispatch('setPeriod', 'month')"
v-on:onClose="visiblePeriodMenu = !visiblePeriodMenu")
ContextMenuItem(
icon="mdi mdi-calendar-star"
- title="Year"
+ :title="$lang.dates.year.simple"
:selected="$store.state.filter.period === 'year'"
v-on:onClick="$store.dispatch('setPeriod', 'year')"
v-on:onClose="visiblePeriodMenu = !visiblePeriodMenu")
ContextMenuItem(
icon="mdi mdi-database"
- title="Show all"
+ :title="$store.state.lang.lang === 'ru' ? 'Показать всё' : 'Show all'"
:selected="$store.state.filter.period === 'all'"
v-on:onClick="$store.dispatch('setPeriod', 'all')"
v-on:onClose="visiblePeriodMenu = !visiblePeriodMenu")
diff --git a/src/components/settings/Settings.vue b/src/components/settings/Settings.vue
index bcb4ddd8..738a2f2d 100644
--- a/src/components/settings/Settings.vue
+++ b/src/components/settings/Settings.vue
@@ -1,11 +1,13 @@
<script>
import Button from '@/components/shared/button/Button'
import ModalBottomConfirm from '@/components/modal/ModalBottomConfirm'
+import LangDropdown from '@/components/lang/LangDropdown'
export default {
components: {
Button,
- ModalBottomConfirm
+ ModalBottomConfirm,
+ LangDropdown
},
data () {
@@ -31,18 +33,25 @@ export default {
<template lang="pug">
.settings
- .settings__header Settings
+ .settings__header {{ $lang.settings.title }}
.settings__group(v-if="$store.state.ui.mobile")
- .settings__subHeader Transaction form
+ .settings__subHeader {{ $lang.trnForm.title }}
.settings__item
Button._bdb(
+ :checkboxValue="$store.state.ui.lastUsedCatsInTrnForm === 'visible'"
+ :showCheckbox="true"
+ :title="$lang.trnForm.lastUsedCats"
icon="mdi mdi-chart-bubble"
- :title="$store.state.ui.lastUsedCatsInTrnForm === 'visible' ? 'Show last used categories' : 'Hide last used categories'"
v-on:onClick="$store.dispatch('toogleLastUsedCatsInTrnForm')")
.settings__group
- .settings__subHeader Application
+ .settings__subHeader {{ $lang.settings.lang }}
+ .settings__item
+ LangDropdown
+
+ .settings__group
+ .settings__subHeader {{ $lang.settings.app }}
.settings__item
Button._bdb(
icon="mdi mdi-palette"
@@ -54,9 +63,9 @@ export default {
title="Sign Out"
v-on:onClick="$store.dispatch('signOut')")
- .settings__group
- .settings__subHeader Delete
- .settings__desc This will delete all your wallets, categories and trns
+ .settings__group._paddingTop
+ .settings__subHeader {{ $lang.settings.delete }}
+ .settings__desc {{ $lang.alerts.willDeleteEverything }}
.settings__item
Button._bdb(
icon="mdi mdi-delete"
@@ -64,8 +73,8 @@ export default {
v-on:onClick="confirmRemoveUserData = true")
.settings__group(v-if="$store.state.demo.hasDemo")
- .settings__subHeader Demo
- .settings__desc This will delete all your wallets, categories and trns
+ .settings__subHeader {{ $lang.settings.demo }}
+ .settings__desc {{ $lang.alerts.willDeleteEverything }}
.settings__item
Button._bdb(
icon="mdi mdi-test-tube"
diff --git a/src/components/shared/date/Date.vue b/src/components/shared/date/Date.vue
index 6b0981f3..30bfe196 100644
--- a/src/components/shared/date/Date.vue
+++ b/src/components/shared/date/Date.vue
@@ -12,7 +12,7 @@ export default {
switch (filterPeriod) {
case 'day':
if (today.isSame(filterDate, 'day')) {
- return 'Today'
+ return this.$lang.dates.day.current
} else if (today.subtract(1, filterPeriod).isSame(filterDate, 'day')) {
return 'Yesterday'
}
@@ -21,7 +21,7 @@ export default {
case 'week':
if (today.isSame(filterDate, 'week')) {
- return 'This week'
+ return this.$lang.dates.week.current
} else if (today.subtract(1, filterPeriod).isSame(filterDate, 'week')) {
return 'Last week'
}
@@ -32,7 +32,7 @@ export default {
case 'month':
if (today.isSame(filterDate, 'month')) {
- return 'This month'
+ return this.$lang.dates.month.current
} else if (today.subtract(1, filterPeriod).isSame(filterDate, 'month')) {
return 'Last month'
}
diff --git a/src/components/stat/StatMobile.vue b/src/components/stat/StatMobile.vue
index 481dfe25..6cfca9cf 100644
--- a/src/components/stat/StatMobile.vue
+++ b/src/components/stat/StatMobile.vue
@@ -101,7 +101,7 @@ export default {
//------------------------------------------------
EmptyData(
v-if="stat.incomes.categoriesIds.length === 0 && stat.expenses.categoriesIds.length === 0 && $store.getters.selectedTrnsIdsWithDate.length === 0"
- text="No stat for this period")
+ :text="$lang.stat.empty")
//- history
//------------------------------------------------
@@ -116,7 +116,7 @@ export default {
.statGroup(v-if="stat.incomes.categoriesIds.length")
.statItem-header
.statItem-total
- .statItem-total__title._incomes Incomes
+ .statItem-total__title._incomes {{ $lang.money.incomes }}
.statItem-total__amount
Amount(
:currency="$store.state.currencies.base"
@@ -125,7 +125,7 @@ export default {
.statItem-average(v-if="$store.state.stat.showedPeriods > 1")
.statItem-average__title
.statItem-average__title-icon: .mdi.mdi-chart-timeline
- .statItem-average__title-text Average
+ .statItem-average__title-text {{ $lang.money.average }}
.statItem-average__amount
Amount(
:currency="$store.state.currencies.base"
@@ -151,7 +151,7 @@ export default {
.statGroup(v-if="stat.expenses.categoriesIds.length")
.statItem-header
.statItem-total
- .statItem-total__title._expenses Expenses
+ .statItem-total__title._expenses {{ $lang.money.expenses }}
.statItem-total__amount
Amount(
:currency="$store.state.currencies.base"
@@ -160,7 +160,7 @@ export default {
.statItem-average(v-if="$store.state.stat.showedPeriods > 1")
.statItem-average__title
.statItem-average__title-icon: .mdi.mdi-chart-timeline
- .statItem-average__title-text Average
+ .statItem-average__title-text {{ $lang.money.average }}
.statItem-average__amount
Amount(
:currency="$store.state.currencies.base"
@@ -191,32 +191,32 @@ export default {
template(slot="opener")
Dropdown._inline(
:active="visibleCustomizeMenu"
- title="Customize")
+ :title="$lang.settings.customize")
template(slot="content")
ContextMenuItem(
icon="mdi mdi-credit-card-multiple"
title="Wallets"
- :checkValue="$store.state.ui.stat.walletsVisibility === 'visible'"
- v-on:onClick="$store.dispatch('setStatWalletsVisibility')"
- v-on:onClose="visibleCustomizeMenu = !visibleCustomizeMenu")
+ :showCheckbox="true"
+ :checkboxValue="$store.state.ui.stat.walletsVisibility === 'visible'"
+ v-on:onClick="$store.dispatch('setStatWalletsVisibility')")
ContextMenuItem(
icon="mdi mdi-chart-bar-stacked"
title="Periods chart"
- :checkValue="$store.state.ui.statGraphsVisible"
- v-on:onClick="$store.dispatch('toogleShowStatGraphs')"
- v-on:onClose="visibleCustomizeMenu = !visibleCustomizeMenu")
+ :showCheckbox="true"
+ :checkboxValue="$store.state.ui.statGraphsVisible"
+ v-on:onClick="$store.dispatch('toogleShowStatGraphs')")
ContextMenuItem(
icon="mdi mdi-chart-bubble"
title="Cats chart"
- :checkValue="$store.state.ui.catsChart === 'visible'"
- v-on:onClick="$store.dispatch('toogleVisibleCatsChart')"
- v-on:onClose="visibleCustomizeMenu = !visibleCustomizeMenu")
+ :showCheckbox="true"
+ :checkboxValue="$store.state.ui.catsChart === 'visible'"
+ v-on:onClick="$store.dispatch('toogleVisibleCatsChart')")
ContextMenuItem(
icon="mdi mdi-chart-gantt"
title="Cats stat"
- :checkValue="$store.state.ui.statItems === 'visible'"
- v-on:onClick="$store.dispatch('toogleVisibilityStatItems')"
- v-on:onClose="visibleCustomizeMenu = !visibleCustomizeMenu")
+ :showCheckbox="true"
+ :checkboxValue="$store.state.ui.statItems === 'visible'"
+ v-on:onClick="$store.dispatch('toogleVisibilityStatItems')")
.context-menu-sep
ContextMenuItem(
icon="mdi mdi-palette"
diff --git a/src/components/stat/StatSummaryMobile.vue b/src/components/stat/StatSummaryMobile.vue
index eae458eb..e156ebd5 100644
--- a/src/components/stat/StatSummaryMobile.vue
+++ b/src/components/stat/StatSummaryMobile.vue
@@ -24,7 +24,7 @@ export default {
.summary
.summary__item._incomes(@click="$store.dispatch('toogleVisibleCatsChart')")
template(v-if="statAverage.incomes > 0 || period === 'all'")
- .summary__item__title._incomes Incomes
+ .summary__item__title._incomes {{ $lang.money.incomes }}
.summary__item__amount
Amount(
:center="true"
@@ -36,7 +36,7 @@ export default {
.summary__item._total(@click="$store.dispatch('toogleVisibilityStatItems')")
template(v-if="statAverage.total !== 0")
template(v-if="stat.incomes.total.incomes > 0 || stat.expenses.total.expenses > 0")
- .summary__item__title Total
+ .summary__item__title {{ $lang.money.total }}
.summary__item__amount
Amount(
:center="true"
@@ -46,7 +46,7 @@ export default {
.summary__item._expenses(@click="$store.dispatch('toogleShowStatGraphs')")
template(v-if="statAverage.expenses > 0 || period === 'all'")
- .summary__item__title._expenses Expenses
+ .summary__item__title._expenses {{ $lang.money.expenses }}
.summary__item__amount
Amount(
:center="true"
diff --git a/src/components/stat/StatSummaryPc.vue b/src/components/stat/StatSummaryPc.vue
index 836b1abd..42dbf8d7 100644
--- a/src/components/stat/StatSummaryPc.vue
+++ b/src/components/stat/StatSummaryPc.vue
@@ -27,7 +27,7 @@ export default {
.summary__item(:class="{ _expenses: statAverage.expenses > 0 || period === 'all' }")
template(v-if="statAverage.expenses > 0 || period === 'all'")
.summary__row
- .summary__title._expenses Expenses
+ .summary__title._expenses {{ $lang.money.expenses }}
.summary__amount
Amount(
:big="true"
@@ -71,7 +71,7 @@ export default {
.summary__item(:class="{ _incomes: statAverage.incomes > 0 || period === 'all' }")
template(v-if="statAverage.incomes > 0 || period === 'all'")
.summary__row
- .summary__title._incomes Incomes
+ .summary__title._incomes {{ $lang.money.incomes }}
.summary__amount
Amount(
:big="true"
@@ -83,7 +83,7 @@ export default {
.summary__row
.summary__average
.summary__average__icon: .mdi.mdi-chart-timeline
- .summary__average__title Average
+ .summary__average__title {{ $lang.money.average }}
.summary__amount._average
Amount(
:currency="$store.state.currencies.base"
diff --git a/src/components/trnForm/TrnFormAmount.vue b/src/components/trnForm/TrnFormAmount.vue
index ea99a11c..0e4feb16 100644
--- a/src/components/trnForm/TrnFormAmount.vue
+++ b/src/components/trnForm/TrnFormAmount.vue
@@ -120,16 +120,13 @@ export default {
<template lang="pug">
.trnFormAmount(:class="className")
- //- pre {{ this.$store.state.trnForm.values.amountArray }}
- //- pre {{ amountString }}
- //- pre {{ amountValue }}
//- mobile
template(v-if="$store.state.ui.mobile")
.trnFormAmount__in(@click="handleChangeAmountType")
.trnFormAmount__type
- template(v-if="amountType === 0") Expense
- template(v-if="amountType === 1") Incomes
- template(v-if="amountType === 2 && $store.getters.walletsSortedIds.length > 1") Transfer
+ template(v-if="amountType === 0") {{ $lang.money.expenses }}
+ template(v-if="amountType === 1") {{ $lang.money.incomes }}
+ template(v-if="amountType === 2 && $store.getters.walletsSortedIds.length > 1") {{ $lang.money.transfer }}
.trnFormAmount__value {{ amountString }}
@@ -140,11 +137,11 @@ export default {
.trnFormAmountPc__type._expenses(
@click="() => setAmountType(0)"
:class="{ _active: amountType === 0 }"
- ) Expenses
+ ) {{ $lang.money.expenses }}
.trnFormAmountPc__type._incomes(
@click="() => setAmountType(1)"
:class="{ _active: amountType === 1 }"
- ) Incomes
+ ) {{ $lang.money.incomes }}
.trnFormAmountPc__type(
v-if="$store.getters.walletsSortedIds.length > 1"
@click="() => setAmountType(2)"
diff --git a/src/components/trnForm/TrnFormModalCats.vue b/src/components/trnForm/TrnFormModalCats.vue
index f1974f6a..a9508fbd 100644
--- a/src/components/trnForm/TrnFormModalCats.vue
+++ b/src/components/trnForm/TrnFormModalCats.vue
@@ -51,7 +51,7 @@ TrnFormModal(
)
template(slot="header")
.trnFormModal__header__back: .mdi.mdi-chevron-left
- .trnFormModal__header__title Categories
+ .trnFormModal__header__title {{ $lang.categories.title }}
.trnFormModal__icon
Icon(
icon="mdi mdi-chart-bubble"
diff --git a/src/components/trnForm/TrnFormModalWallets.vue b/src/components/trnForm/TrnFormModalWallets.vue
index f56317b3..92f0e1df 100644
--- a/src/components/trnForm/TrnFormModalWallets.vue
+++ b/src/components/trnForm/TrnFormModalWallets.vue
@@ -27,7 +27,7 @@ TrnFormModal(
)
template(slot="header")
.trnFormModal__header__back: .mdi.mdi-chevron-left
- .trnFormModal__header__title Wallets
+ .trnFormModal__header__title {{ $lang.wallets.title }}
.trnFormModal__icon
Icon(
icon="mdi mdi-credit-card-multiple"
diff --git a/src/components/wallets/total/WalletsTotal.vue b/src/components/wallets/total/WalletsTotal.vue
index df92baf9..b6a6bfc9 100644
--- a/src/components/wallets/total/WalletsTotal.vue
+++ b/src/components/wallets/total/WalletsTotal.vue
@@ -40,7 +40,7 @@ export default {
<template lang="pug">
.wallets-total(v-if="$store.getters.hasWallets")
.wallets-total__item
- .wallets-total__title Total
+ .wallets-total__title {{ $lang.money.total }}
.wallets-total__value
Amount(
:currency="$store.state.currencies.base"
diff --git a/src/lang/en.json b/src/lang/en.json
new file mode 100644
index 00000000..e58dba02
--- /dev/null
+++ b/src/lang/en.json
@@ -0,0 +1,72 @@
+{
+ "settings": {
+ "title": "Settings",
+ "lang": "Language",
+ "options": "Options",
+ "open": "Open settings",
+ "customize": "Сustomize",
+ "app": "Application",
+ "delete": "Delete",
+ "demo": "Demo"
+ },
+
+ "wallets": {
+ "title": "Wallets",
+ "new": "New wallet"
+ },
+
+ "categories": {
+ "title": "Categories",
+ "shortTitle": "Cats",
+ "new": "New category"
+ },
+
+ "stat": {
+ "shortTitle": "Stat",
+ "empty": "No stat for this period"
+ },
+
+ "trns": {
+ "shortTitle": "Trns"
+ },
+
+ "create": {
+ "title": "Create"
+ },
+
+ "trnForm": {
+ "title": "Transaction form",
+ "lastUsedCats": "Last used categories"
+ },
+
+ "money": {
+ "incomes": "Incomes",
+ "expenses": "Expenses",
+ "transfer": "Transfer",
+ "total": "Total",
+ "average": "Average"
+ },
+
+ "dates": {
+ "day": {
+ "current": "Today",
+ "simple": "Day"
+ },
+ "week": {
+ "current": "This week",
+ "simple": "Week"
+ },
+ "month": {
+ "current": "This month",
+ "simple": "Month"
+ },
+ "year": {
+ "current": "This year",
+ "simple": "Year"
+ }
+ },
+
+ "alerts": {
+ "willDeleteEverything": "This will delete all your wallets, categories and trns"
+ }
+}
diff --git a/src/lang/ru.json b/src/lang/ru.json
new file mode 100644
index 00000000..13f3002a
--- /dev/null
+++ b/src/lang/ru.json
@@ -0,0 +1,72 @@
+{
+ "settings": {
+ "title": "Настройки",
+ "lang": "Язык приложения",
+ "options": "Опции",
+ "open": "Открыть настройки",
+ "customize": "Настроить внешний вид",
+ "app": "Приложение",
+ "delete": "Удаление данных",
+ "demo": "Демо режим"
+ },
+
+ "wallets": {
+ "title": "Кошельки",
+ "new": "Новый кошелек"
+ },
+
+ "categories": {
+ "title": "Категории",
+ "shortTitle": "Категории",
+ "new": "Новая категория"
+ },
+
+ "stat": {
+ "shortTitle": "Статистика",
+ "empty": "Статистики за выбранный период нетю :)"
+ },
+
+ "trns": {
+ "shortTitle": "История"
+ },
+
+ "create": {
+ "title": "Создать"
+ },
+
+ "trnForm": {
+ "title": "Создание транзакции",
+ "lastUsedCats": "Последние категории"
+ },
+
+ "money": {
+ "incomes": "Доход",
+ "expenses": "Расход",
+ "transfer": "Перевод",
+ "total": "Итого",
+ "average": "Среднее"
+ },
+
+ "dates": {
+ "day": {
+ "current": "Сегодня",
+ "simple": "День"
+ },
+ "week": {
+ "current": "Текущая неделя",
+ "simple": "Неделя"
+ },
+ "month": {
+ "current": "Текущий месяц",
+ "simple": "Месяц"
+ },
+ "year": {
+ "current": "Текущий год",
+ "simple": "Год"
+ }
+ },
+
+ "alerts": {
+ "willDeleteEverything": "Все кошельки, категории и транзакции будут удалены"
+ }
+}
diff --git a/src/main.js b/src/main.js
index 5f823be9..a0102995 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,6 +1,7 @@
import Vue from 'vue'
import HighchartsVue from 'highcharts-vue'
import Notifications from 'vue-notification'
+import Lang from 'vue-lang'
import App from '@/components/app/App'
import store from '@/store'
@@ -14,6 +15,12 @@ Vue.config.performance = false
Vue.use(HighchartsVue)
Vue.use(Notifications)
+const locales = {
+ 'en': require('@/lang/en.json'),
+ 'ru': require('@/lang/ru.json')
+}
+Vue.use(Lang, { lang: 'en', locales })
+
new Vue({
store,
render: h => h(App)
diff --git a/src/store/index.js b/src/store/index.js
index 7dc1e458..0d92d048 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -8,6 +8,7 @@ import currencies from '@/components/currencies/store'
import dashboard from '@/components/dashboard/store'
import demo from '@/components/demo/store'
import filter from '@/components/filter/store'
+import lang from '@/components/lang/store'
import stat from '@/components/stat/store'
import trnForm from '@/components/trnForm/store'
import trns from '@/components/trns/store'
@@ -26,6 +27,7 @@ export default new Vuex.Store({
dashboard,
demo,
filter,
+ lang,
stat,
trnForm,
trns,