diff --git a/src/api/index.js b/src/api/index.js
index a5f073295..c644c15e2 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -9,6 +9,14 @@ class APIService {
this.defaultHeaders = {
'Content-Type': 'application/json',
};
+
+ const i18n = this.services?.i18n;
+ if (i18n) {
+ this.setHeader('X-Lang', i18n.getLocale());
+ i18n.subscribe(locale => {
+ return this.setHeader('X-Lang', locale);
+ });
+ }
}
/**
diff --git a/src/app/article/index.js b/src/app/article/index.js
index 54f037b64..fe7318501 100644
--- a/src/app/article/index.js
+++ b/src/app/article/index.js
@@ -14,19 +14,21 @@ import { useDispatch, useSelector } from 'react-redux';
import shallowequal from 'shallowequal';
import articleActions from '../../store-redux/article/actions';
import HeadLayout from '../../components/head-layout';
+import Comments from '../../containers/comments';
+import useServices from '../../hooks/use-services';
function Article() {
const store = useStore();
+ const services = useServices();
+ const locale = services.i18n?.getLocale();
const dispatch = useDispatch();
- // Параметры из пути /articles/:id
const params = useParams();
useInit(() => {
- //store.actions.article.load(params.id);
dispatch(articleActions.load(params.id));
- }, [params.id]);
+ }, [params.id, locale]);
const select = useSelector(
state => ({
@@ -34,8 +36,7 @@ function Article() {
waiting: state.article.waiting,
}),
shallowequal,
- ); // Нужно указать функцию для сравнения свойства объекта, так как хуком вернули объект
-
+ );
const { t } = useTranslate();
const callbacks = {
@@ -55,6 +56,7 @@ function Article() {
+
>
diff --git a/src/app/main/index.js b/src/app/main/index.js
index d9fb1c6c2..ce462596e 100644
--- a/src/app/main/index.js
+++ b/src/app/main/index.js
@@ -10,15 +10,19 @@ import CatalogList from '../../containers/catalog-list';
import LocaleSelect from '../../containers/locale-select';
import TopHead from '../../containers/top-head';
import HeadLayout from '../../components/head-layout';
+import useServices from '../../hooks/use-services';
function Main() {
const store = useStore();
+ const services = useServices();
+ const locale = services.i18n?.getLocale();
useInit(
async () => {
await Promise.all([store.actions.catalog.initParams(), store.actions.categories.load()]);
},
[],
+ [locale],
true,
);
diff --git a/src/app/profile/index.js b/src/app/profile/index.js
index 166d127fb..76043ab05 100644
--- a/src/app/profile/index.js
+++ b/src/app/profile/index.js
@@ -37,7 +37,7 @@ function Profile() {
-
+
>
diff --git a/src/components/article-card/index.js b/src/components/article-card/index.js
index d636d9f88..03073b60e 100644
--- a/src/components/article-card/index.js
+++ b/src/components/article-card/index.js
@@ -13,22 +13,22 @@ function ArticleCard(props) {
{article.description}
-
Страна производитель:
+
{t('card.country')}
{article.madeIn?.title} ({article.madeIn?.code})
-
Категория:
+
{t('card.сategory')}
{article.category?.title}
-
Год выпуска:
+
{t('card.year')}
{article.edition}
-
Цена:
+
{t('card.price')}
{numberFormat(article.price)} ₽