From d51639b9e276fe2a963c8d5f43bd5930120880e5 Mon Sep 17 00:00:00 2001 From: tapo4ek Date: Tue, 24 Sep 2024 14:53:50 +0300 Subject: [PATCH] feat(Table): removed all localisation components, they are not needed --- .storybook/decorators/withLang.tsx | 3 --- src/i18n.ts | 11 ---------- src/utils/configure.ts | 33 ------------------------------ src/utils/index.ts | 1 - 4 files changed, 48 deletions(-) delete mode 100644 src/i18n.ts delete mode 100644 src/utils/configure.ts diff --git a/.storybook/decorators/withLang.tsx b/.storybook/decorators/withLang.tsx index 22a430c..a816609 100644 --- a/.storybook/decorators/withLang.tsx +++ b/.storybook/decorators/withLang.tsx @@ -3,13 +3,10 @@ import React from 'react'; import {configure} from '@gravity-ui/uikit'; import type {Decorator} from '@storybook/react'; -import {configure as localConfigure} from '../../src/utils'; - export const withLang: Decorator = (Story, context) => { const lang = context.globals.lang; configure({lang}); - localConfigure({lang}); return ; }; diff --git a/src/i18n.ts b/src/i18n.ts deleted file mode 100644 index 785fec7..0000000 --- a/src/i18n.ts +++ /dev/null @@ -1,11 +0,0 @@ -import {I18N} from '@gravity-ui/i18n'; - -import {getConfig, subscribeConfigure} from './utils'; - -const configLang = getConfig().lang; - -export const i18n = new I18N({lang: configLang, fallbackLang: configLang}); - -subscribeConfigure((config) => { - i18n.setLang(config.lang); -}); diff --git a/src/utils/configure.ts b/src/utils/configure.ts deleted file mode 100644 index 89f4f2c..0000000 --- a/src/utils/configure.ts +++ /dev/null @@ -1,33 +0,0 @@ -export enum Lang { - Ru = 'ru', - En = 'en', -} - -interface Config { - lang: `${Lang}`; -} - -type Subscriber = (config: Config) => void; - -let subs: Subscriber[] = []; - -const config: Config = { - lang: Lang.En, -}; - -export const configure = (newConfig: Partial) => { - Object.assign(config, newConfig); - subs.forEach((sub) => { - sub(config); - }); -}; - -export const subscribeConfigure = (sub: Subscriber) => { - subs.push(sub); - - return () => { - subs = subs.filter((item) => item !== sub); - }; -}; - -export const getConfig = () => config; diff --git a/src/utils/index.ts b/src/utils/index.ts index ae8b0d6..aa3d3f6 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -11,4 +11,3 @@ export * from './getVirtualRowRangeExtractor'; export * from './shouldRenderFooterCell'; export * from './shouldRenderFooterRow'; export * from './shouldRenderHeaderCell'; -export * from './configure';