Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into feature/localize-profile-page
Browse files Browse the repository at this point in the history
# Conflicts:
#	client/src/i18n.ts
  • Loading branch information
bas-kirill committed Aug 30, 2024
2 parents 36a3f72 + 790ba03 commit ab1ac94
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
15 changes: 15 additions & 0 deletions client/src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export const I18N_INSTRUMENT_BASIC_MATERIALS = "instrument.basic.materials";
export const I18N_INSTRUMENT_DATE_FROM = "instrument.date.from";
export const I18N_INSTRUMENT_DATE_TO = "instrument.date.to";

export const I18N_INSTRUMENT_CARD_SHOW_BUTTON = "instrument.card.show.button";

export const I18N_LOGIN_INPUT = "login.login.input";
export const I18N_LOGIN_PASSWORD_INPUT = "login.login.password";
export const I18N_LOGIN_BUTTON = "login.login.button";
Expand All @@ -41,6 +43,9 @@ export const I18N_LOGOUT_BUTTON = "logout.button";

export const I18N_FOOTER = "footer";

export const I18N_NAVBAR_PREVIOUS = "navbar.previous";
export const I18N_NAVBAR_NEXT = "navbar.next";

const resources = {
en: {
translation: {
Expand All @@ -66,6 +71,8 @@ const resources = {
[I18N_INSTRUMENT_DATE_FROM]: "From",
[I18N_INSTRUMENT_DATE_TO]: "To",

[I18N_INSTRUMENT_CARD_SHOW_BUTTON]: "Show",

[I18N_LOGIN_INPUT]: "Login",
[I18N_LOGIN_PASSWORD_INPUT]: "Password",
[I18N_LOGIN_BUTTON]: "Login",
Expand All @@ -78,6 +85,9 @@ const resources = {
[I18N_PROFILE_ROLE_SPAN]: "Role",

[I18N_FOOTER]: "Muse Group Frontend Academy",

[I18N_NAVBAR_PREVIOUS]: "Previous",
[I18N_NAVBAR_NEXT]: "Next",
}
},
ru: {
Expand All @@ -104,6 +114,11 @@ const resources = {
[I18N_INSTRUMENT_DATE_FROM]: "С",
[I18N_INSTRUMENT_DATE_TO]: "По",

[I18N_INSTRUMENT_CARD_SHOW_BUTTON]: "Показать",

[I18N_NAVBAR_PREVIOUS]: "Предыдущий",
[I18N_NAVBAR_NEXT]: "Следующий",

[I18N_LOGIN_INPUT]: "Логин",
[I18N_LOGIN_PASSWORD_INPUT]: "Пароль",
[I18N_LOGIN_BUTTON]: "Войти",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import { useNavigate } from "react-router-dom";

import { InstrumentDetail } from "generated/model";
import { useDarkMode } from "shared/dark-mode/use-dark-mode";
import { useTranslation } from "react-i18next";
import { I18N_INSTRUMENT_CARD_SHOW_BUTTON } from "../../../i18n";

interface Props {
instrument: InstrumentDetail;
}

export const ShowInstrumentButton = (props: Props) => {
const { t } = useTranslation();
const { darkMode } = useDarkMode();
const navigate = useNavigate();

Expand All @@ -27,7 +30,7 @@ export const ShowInstrumentButton = (props: Props) => {
`}
onClick={handleOnClick}
>
Show
{t(I18N_INSTRUMENT_CARD_SHOW_BUTTON)}
</button>
);
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from "react";
import styles from "./styles/NavigationBar.widget.module.css";
import { useDarkMode } from "shared/dark-mode/use-dark-mode";
import { useTranslation } from "react-i18next";
import { I18N_NAVBAR_NEXT, I18N_NAVBAR_PREVIOUS } from "../../../i18n";

interface Props {
totalPages: number;
Expand All @@ -9,6 +11,7 @@ interface Props {
}

export const NavigationBarWidget = (props: Props) => {
const { t } = useTranslation();
const { darkMode } = useDarkMode();

return (
Expand All @@ -25,7 +28,7 @@ export const NavigationBarWidget = (props: Props) => {
`}
onClick={() => props.setPageNumber(Math.max(1, props.pageNumber - 1))}
>
Previous
{t(I18N_NAVBAR_PREVIOUS)}
</button>

<button
Expand All @@ -37,7 +40,7 @@ export const NavigationBarWidget = (props: Props) => {
props.setPageNumber(Math.min(props.pageNumber + 1, props.totalPages))
}
>
Next
{t(I18N_NAVBAR_NEXT)}
</button>
</div>
);
Expand Down

0 comments on commit ab1ac94

Please sign in to comment.