From b2ba49df23437f79ad530da25d53cd719097ba67 Mon Sep 17 00:00:00 2001 From: mnenie <121057011+mneniee@users.noreply.github.com> Date: Sat, 20 Jul 2024 18:41:42 +0300 Subject: [PATCH 1/4] feat: add i18n, localization: layout --- .husky/pre-commit | 2 - package.json | 4 +- src/app/index.ts | 3 + src/app/providers/router/index.ts | 6 +- src/features/filter/ui/SearchFilter.vue | 8 +- src/features/plan/ui/PlanCard.vue | 4 +- .../lang-switcher/ui/LanguageSwitcher.vue | 41 +- src/shared/lib/i18n/index.ts | 33 + src/shared/lib/i18n/locales/en-US.ts | 17 + src/shared/lib/i18n/locales/ru-RU.ts | 17 + src/shared/ui/select/UiSelect.vue | 12 +- src/shared/ui/select/types.ts | 5 +- src/widgets/layout/config/links.ts | 8 +- src/widgets/layout/ui/header/HeaderMain.vue | 24 +- src/widgets/layout/ui/sidebar/Sidebar.vue | 6 +- src/widgets/layout/ui/sidebar/WorkSpace.vue | 19 +- yarn.lock | 812 ++++++++++-------- 17 files changed, 601 insertions(+), 420 deletions(-) create mode 100644 src/shared/lib/i18n/index.ts create mode 100644 src/shared/lib/i18n/locales/en-US.ts create mode 100644 src/shared/lib/i18n/locales/ru-RU.ts diff --git a/.husky/pre-commit b/.husky/pre-commit index 5a182ef..35b91f0 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,2 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" yarn lint-staged diff --git a/package.json b/package.json index 10e9bad..7e5370e 100644 --- a/package.json +++ b/package.json @@ -28,15 +28,17 @@ "@unhead/vue": "^1.9.14", "@vee-validate/zod": "^4.13.1", "@vueuse/core": "^10.11.0", - "@vueuse/integrations": "^10.11.0", + "@vueuse/integrations": "^10.10.0", "axios": "^1.7.2", "chart.js": "^4.4.3", "floating-vue": "^5.2.2", "lucide-vue-next": "^0.396.0", "pinia": "^2.1.7", "splitpanes": "^3.1.5", + "universal-cookie": "^6.1.3", "vee-validate": "^4.13.1", "vue": "^3.4.29", + "vue-i18n": "9", "vue-router": "^4.3.3", "vue-sonner": "^1.1.3", "zod": "^3.23.8" diff --git a/src/app/index.ts b/src/app/index.ts index 070d625..e2c4070 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -2,6 +2,8 @@ import { createApp } from 'vue'; import { router, pinia } from './providers'; import { createHead } from '@unhead/vue'; import App from './App.vue'; +import i18n from '@/shared/lib/i18n'; + import './styles/primary/index.scss'; import 'floating-vue/dist/style.css'; @@ -14,6 +16,7 @@ const head = createHead(); app.use(pinia); app.use(router); +app.use(i18n); app.use(head); app.use(autoAnimatePlugin); app.directive('tooltip', vTooltip); diff --git a/src/app/providers/router/index.ts b/src/app/providers/router/index.ts index ea9c0ff..de98924 100644 --- a/src/app/providers/router/index.ts +++ b/src/app/providers/router/index.ts @@ -81,7 +81,7 @@ export const router = createRouter({ router.beforeEach((to, from) => { // TODO(@mnenie): Add guards logic // Needs to add guard auth logic in router - if (to.meta.requiresAuth === true) { - return router.push({ name: RouteNames.login }); - } + // if (to.meta.requiresAuth === true) { + // return router.push({ name: RouteNames.login }); + // } }); diff --git a/src/features/filter/ui/SearchFilter.vue b/src/features/filter/ui/SearchFilter.vue index 3702d9b..1031895 100644 --- a/src/features/filter/ui/SearchFilter.vue +++ b/src/features/filter/ui/SearchFilter.vue @@ -1,9 +1,10 @@