Browse Source

setting locale type redid & cabab-case rename components

merge-requests/2/head
YaroslavBerkuta 2 years ago
parent
commit
8196ed779b
  1. 36
      src/i18n/locales/en/settings.translation.ts
  2. 2
      src/i18n/locales/en/steps.translation.ts
  3. 36
      src/i18n/locales/ua/settings.translation.ts
  4. 6
      src/i18n/types/index.ts
  5. 0
      src/i18n/types/onBoarding.types.ts
  6. 15
      src/i18n/types/onSettings.ts
  7. 12
      src/i18n/types/settings.types.ts
  8. 2
      src/module/root/components/content-onBoarding.component.tsx
  9. 2
      src/module/root/config/data-onBoarding.config.ts
  10. 4
      src/module/root/screens/settings.screen.tsx
  11. 4
      src/module/setting/atoms/selectedLanguage-inSettings.atom.tsx
  12. 43
      src/module/setting/config/data-Setting.tsx
  13. 41
      src/module/setting/config/data-setting.config.tsx
  14. 2
      src/module/shared/components/Header/Header.component.tsx
  15. 4
      src/module/shared/components/index.tsx

36
src/i18n/locales/en/settings.translation.ts

@ -1,27 +1,11 @@ @@ -1,27 +1,11 @@
import {OnSettingLocale} from '../../types/onSettings';
export const settingTranslation: OnSettingLocale.OnSettingLocale = {
setting1: {
title: 'Purchases!',
},
setting2: {
title: 'Language',
},
setting3: {
title: 'Write to us',
},
setting4: {
title: 'Rate us',
},
setting5: {
title: 'Share app',
},
setting6: {
title: 'Privacy policy',
},
setting7: {
title: 'Terms and conditions',
},
setting8: {
title: 'Information',
},
import {SettingLocale} from '../../types/settings.types';
export const settingTranslation: SettingLocale.core = {
purchases: 'Purchases!',
language: 'Language',
write: 'Write to us',
rate: 'Rate us',
share: 'Share app',
policy: 'Privacy policy',
term: 'Terms and conditions',
information: 'Information',
};

2
src/i18n/locales/en/steps.translation.ts

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
import {OnBoardingLocale} from '../../types/onBoarding';
import {OnBoardingLocale} from '../../types/onBoarding.types';
export const onBoardingTranslation: OnBoardingLocale.OnboardingSteps = {
step1: {
title: 'Welcome!',

36
src/i18n/locales/ua/settings.translation.ts

@ -1,27 +1,11 @@ @@ -1,27 +1,11 @@
import {OnSettingLocale} from '../../types/onSettings';
export const settingTranslation: OnSettingLocale.OnSettingLocale = {
setting1: {
title: 'Магазин!',
},
setting2: {
title: 'Мова',
},
setting3: {
title: 'Напишіть нам',
},
setting4: {
title: 'Оцініть нас',
},
setting5: {
title: 'Поділитися програмою',
},
setting6: {
title: 'Політика конфіденційності',
},
setting7: {
title: 'Правила та умови',
},
setting8: {
title: 'Інформація',
},
import {SettingLocale} from '../../types/settings.types';
export const settingTranslation: SettingLocale.core = {
purchases: 'Магазин!',
language: 'Мова',
write: 'Напишіть нам',
rate: 'Оцініть нас',
share: 'Поділитися програмою',
policy: 'Політика конфіденційності',
term: 'Правила та умови',
information: 'Інформація',
};

6
src/i18n/types/index.ts

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
import {OnBoardingLocale} from './onBoarding';
import { OnSettingLocale } from './onSettings';
import {OnBoardingLocale} from './onBoarding.types';
import { SettingLocale } from './settings.types';
export interface MainLocaleModule {
stepTranslation: OnBoardingLocale.OnboardingSteps;
settingTranslation: OnSettingLocale.OnSettingLocale;
settingTranslation: SettingLocale.core;
}

0
src/i18n/types/onBoarding.ts → src/i18n/types/onBoarding.types.ts

15
src/i18n/types/onSettings.ts

@ -1,15 +0,0 @@ @@ -1,15 +0,0 @@
export namespace OnSettingLocale {
export interface IStep {
title: string;
}
export interface OnSettingLocale {
setting1: IStep;
setting2: IStep;
setting3: IStep;
setting4: IStep;
setting5: IStep;
setting6: IStep;
setting7: IStep;
setting8: IStep;
}
}

12
src/i18n/types/settings.types.ts

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
export namespace SettingLocale {
export interface core {
purchases: string;
language: string;
write: string;
rate: string;
share: string;
policy: string;
term: string;
information: string;
}
}

2
src/module/root/components/content-onBoarding.component.tsx

@ -4,7 +4,7 @@ import {View, Text, StyleSheet} from 'react-native'; @@ -4,7 +4,7 @@ import {View, Text, StyleSheet} from 'react-native';
import {LangKeys} from '../../../i18n';
import {colors, heightPicture} from '../../shared';
import {GroupBtn} from '../atoms/premium-button.component';
import {OnBoardData} from '../config/data-onBoarding';
import {OnBoardData} from '../config/data-onBoarding.config';
interface IProps {
currentIndex: number;
onPressItem: (data: any) => void;

2
src/module/root/config/data-onBoarding.ts → src/module/root/config/data-onBoarding.config.ts

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
import ImageHearts from '../../../assets/image/hearts.svg';
import ImageGlass from '../../../assets/image/glass.svg';
import ImageCup from '../../../assets/image/winners-cup.svg';
import {OnBoardingLocale} from '../../../i18n/types/onBoarding';
import {OnBoardingLocale} from '../../../i18n/types/onBoarding.types';
const translatePath = (
itemKey: keyof OnBoardingLocale.OnboardingSteps,
key: keyof OnBoardingLocale.IStep,

4
src/module/root/screens/settings.screen.tsx

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
import React, {FC} from 'react';
import {StyleSheet, View} from 'react-native';
import {SettingsItem} from '../../setting/components/Settings-Item.component';
import {SettingsData} from '../../setting/config/data-Setting';
import {SettingsItem} from '../../setting/components/settings-item.component';
import {SettingsData} from '../../setting/config/data-setting.config';
import {Header, IRouteParams, colors, ScreenLayout} from '../../shared';
interface IProps extends IRouteParams {}

4
src/module/setting/atoms/LanguageSelect.tsx → src/module/setting/atoms/selectedLanguage-inSettings.atom.tsx

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
import React, {FC} from 'react';
import React from 'react';
import {StyleSheet, Text, View} from 'react-native';
import {useTranslation} from 'react-i18next';
export const LanguageSelect = () => {
export const SelectedLanguage = () => {
const {t, i18n} = useTranslation();
return (
<View style={styles.curentLang}>

43
src/module/setting/config/data-Setting.tsx

@ -1,43 +0,0 @@ @@ -1,43 +0,0 @@
import React from 'react';
import {LanguageSelect} from '../atoms/LanguageSelect';
import {OnSettingLocale} from '../../../i18n/types/onSettings';
const translatePath = (
itemKey: keyof OnSettingLocale.OnSettingLocale,
key: keyof OnSettingLocale.IStep,
) => `settingTranslation.${itemKey}.${key}`;
export const SettingsData = [
{
title: translatePath('setting1', 'title'),
image: 'purchases',
},
{
title: translatePath('setting2', 'title'),
image: 'lang',
component: () => <LanguageSelect />,
},
{
title: translatePath('setting3', 'title'),
image: 'message',
},
{
title: translatePath('setting4', 'title'),
image: 'rate',
},
{
title: translatePath('setting5', 'title'),
image: 'share',
},
{
title: translatePath('setting6', 'title'),
image: 'privacy-policy',
},
{
title: translatePath('setting7', 'title'),
image: 'terms-&-cond',
},
{
title: translatePath('setting8', 'title'),
image: 'information',
},
];

41
src/module/setting/config/data-setting.config.tsx

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
import React from 'react';
import {SelectedLanguage} from '../atoms/selectedLanguage-inSettings.atom';
import {SettingLocale} from '../../../i18n/types/settings.types';
const translatePath = (itemKey: keyof SettingLocale.core) =>
`settingTranslation.${itemKey}`;
export const SettingsData = [
{
title: translatePath('purchases'),
image: 'purchases',
},
{
title: translatePath('language'),
image: 'lang',
component: () => <SelectedLanguage />,
},
{
title: translatePath('write'),
image: 'message',
},
{
title: translatePath('rate'),
image: 'rate',
},
{
title: translatePath('share'),
image: 'share',
},
{
title: translatePath('policy'),
image: 'privacy-policy',
},
{
title: translatePath('term'),
image: 'terms-&-cond',
},
{
title: translatePath('information'),
image: 'information',
},
];

2
src/module/shared/components/Header/Header.component.tsx

@ -7,7 +7,7 @@ import { @@ -7,7 +7,7 @@ import {
ViewStyle,
} from 'react-native';
import {colors} from '../../colors/colors';
import {Icon} from '../Icon/Icon.component';
import {Icon} from '../icon/icon.component';
interface IProps {
onPress: () => void;
style?: ViewStyle;

4
src/module/shared/components/index.tsx

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
export * from './buttons';
export * from './layout/layout.component';
export * from "./Header/Header.component"
export * from "./Icon/Icon.component"
export * from "./header/header.component"
export * from "./icon/icon.component"
Loading…
Cancel
Save