Skip to content

Commit

Permalink
feat: move to @gravity-ui/i18n (#45)
Browse files Browse the repository at this point in the history
* chore: bump @yandex-cloud/i18n

* feat: move to @gravity-ui/i18n

Co-authored-by: Алаев Евгений <alaev89@yandex-team.ru>
  • Loading branch information
ierehon1905 and korvin89 authored Oct 4, 2022
1 parent e15f731 commit ad401d8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
8 changes: 1 addition & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
},
"devDependencies": {
"@gravity-ui/eslint-config": "^1.0.2",
"@gravity-ui/i18n": "^1.0.0",
"@gravity-ui/prettier-config": "^1.0.1",
"@gravity-ui/stylelint-config": "^1.0.1",
"@gravity-ui/tsconfig": "^1.0.0",
Expand All @@ -33,7 +34,6 @@
"@types/react": "^17.0.48",
"@types/react-dom": "^17.0.17",
"@typescript-eslint/eslint-plugin": "^5.31.0",
"@yandex-cloud/i18n": "^0.5.0",
"eslint": "^8.11.0",
"gulp": "^4.0.2",
"gulp-cli": "^2.3.0",
Expand All @@ -59,8 +59,7 @@
"peerDependencies": {
"react": "^16.0.0 || ^17.0.0",
"moment": "^2.19.3",
"@gravity-ui/uikit": "^3.0.0",
"@yandex-cloud/i18n": "^0.5.0"
"@gravity-ui/uikit": "^3.0.0"
},
"scripts": {
"test": "jest",
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {I18N, I18NFn} from '@yandex-cloud/i18n';
import {I18N, I18NFn} from '@gravity-ui/i18n';
import type {ChartKitLang} from '../types';
import en from './keysets/en.json';
import ru from './keysets/ru.json';
Expand Down
24 changes: 24 additions & 0 deletions src/libs/settings/__tests__/settings.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
import {DEFAULT_LOCALE_SPECIFICATION, settings} from '../settings';

const resetSettings = () =>
settings.set({
lang: 'en',
locale: DEFAULT_LOCALE_SPECIFICATION,
});

describe('libs/settings', () => {
it('Default locale should be equal DEFAULT_LOCALE_SPECIFICATION', () => {
const result = settings.get('locale');
expect(result).toBe(DEFAULT_LOCALE_SPECIFICATION);
});

it('Default lang should be equal to en', () => {
const result = settings.get('lang');

expect(result).toBe('en');
});

it('Changed lang should be equal to ru', () => {
settings.set({
lang: 'ru',
});
const result = settings.get('lang');

expect(result).toBe('ru');
});

beforeAll(resetSettings);
afterEach(resetSettings);
});

0 comments on commit ad401d8

Please sign in to comment.