From 476f6dbdabb6a8763256c332750b162cdfe1df83 Mon Sep 17 00:00:00 2001 From: RDMStreet Date: Tue, 20 Jul 2021 09:38:00 +0300 Subject: [PATCH 1/5] Add setLocale method for changing ui library locale --- package.json | 2 +- .../DesignSystem/DesignSystemInject.ts | 4 +- .../SDesignSystemProvider.vue | 8 +-- src/components/DesignSystem/consts.ts | 2 +- src/index.ts | 14 +++-- src/lang/en/index.ts | 7 --- src/locale/en/index.ts | 7 +++ src/{lang => locale}/index.ts | 8 ++- src/locale/ja/index.ts | 7 +++ src/plugins/elementUI.ts | 2 +- src/store/Locale.ts | 56 +++++++++++++++++++ src/store/Theme.ts | 25 +++++---- src/store/index.ts | 7 ++- src/stories/Collapse/SCollapse.stories.ts | 4 +- src/stories/SButton.stories.ts | 6 +- src/stories/SCard.stories.ts | 4 +- src/stories/SDialog.stories.ts | 4 +- src/stories/SFloatInput.stories.ts | 4 +- src/stories/SInput.stories.ts | 4 +- src/stories/SRadio.stories.ts | 4 +- src/stories/SSwitch.stories.ts | 4 +- src/stories/STooltip.stories.ts | 6 +- src/stories/Tab/STabs.stories.ts | 4 +- src/utils/DesignSystem.ts | 2 +- src/utils/Locale.ts | 4 ++ src/utils/Theme.ts | 4 +- src/utils/index.ts | 8 ++- 27 files changed, 150 insertions(+), 61 deletions(-) delete mode 100644 src/lang/en/index.ts create mode 100644 src/locale/en/index.ts rename src/{lang => locale}/index.ts (65%) create mode 100644 src/locale/ja/index.ts create mode 100644 src/store/Locale.ts create mode 100644 src/utils/Locale.ts diff --git a/package.json b/package.json index 906436d4..04587f2b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@soramitsu/soramitsu-js-ui", - "version": "0.9.17", + "version": "0.9.19", "private": false, "publishConfig": { "registry": "https://nexus.iroha.tech/repository/npm-soramitsu/" diff --git a/src/components/DesignSystem/DesignSystemInject.ts b/src/components/DesignSystem/DesignSystemInject.ts index 9b276cee..6adbb16f 100644 --- a/src/components/DesignSystem/DesignSystemInject.ts +++ b/src/components/DesignSystem/DesignSystemInject.ts @@ -1,11 +1,11 @@ import { Component, Vue, Inject, Prop } from 'vue-property-decorator' import { DesignSystemProvideKey } from './consts' -import { DesignSystemTypes } from '../../utils/DesignSystem' +import { DesignSystem } from '../../utils/DesignSystem' @Component export default class DesignSystemInject extends Vue { @Prop({ default: true, type: Boolean }) readonly useDesignSystem!: boolean - @Inject({ from: DesignSystemProvideKey, default: DesignSystemTypes.DEFAULT }) readonly designSystem!: any + @Inject({ from: DesignSystemProvideKey, default: DesignSystem.DEFAULT }) readonly designSystem!: any get designSystemClass (): string { return this.useDesignSystem ? this.designSystem.value : '' diff --git a/src/components/DesignSystem/SDesignSystemProvider/SDesignSystemProvider.vue b/src/components/DesignSystem/SDesignSystemProvider/SDesignSystemProvider.vue index 67829fff..8c353bea 100644 --- a/src/components/DesignSystem/SDesignSystemProvider/SDesignSystemProvider.vue +++ b/src/components/DesignSystem/SDesignSystemProvider/SDesignSystemProvider.vue @@ -7,17 +7,17 @@