-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
321 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export { setActivateSound, settingsReducer } from './model'; | ||
export type { TSettingsSliceState, TSettingsSliceStore } from './model'; | ||
export { useTranslates } from './lib'; | ||
export { changeCurrentLangugage, setActivateSound, settingsReducer } from './model'; | ||
export type { TAvailableLanguages, TSettingsSliceState, TSettingsSliceStore } from './model'; | ||
export { PlaySoundButton } from './ui'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { useTranslates } from './useTranslates'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
export const TRANSLATES = { | ||
startGame: { | ||
'en-US': 'Start game', | ||
'ru-RU': 'Начать игру', | ||
}, | ||
rules: { | ||
'en-US': 'About game', | ||
'ru-RU': 'Об игре', | ||
}, | ||
authors: { | ||
'en-US': 'About authors', | ||
'ru-RU': 'Об авторах', | ||
}, | ||
authorsSubtitle: { | ||
'en-US': 'INFORMATION ABOUT THE AUTHORS', | ||
'ru-RU': 'ИНФОРМАЦИЯ О АВТОРАХ', | ||
}, | ||
authorsTitle: { | ||
'en-US': 'Authors', | ||
'ru-RU': 'Авторы', | ||
}, | ||
authorsNoofficial: { | ||
'en-US': 'THIS IS AN UNOFFICIAL PROJECT! THE AUTHORS OF THE VISUAL NOVEL HAVE NOTHING TO DO WITH THIS PROJECT!', | ||
'ru-RU': 'ЭТО НЕОФИЦИАЛЬНЫЙ ПРОЕКТ! АВТОРЫ ВИЗУАЛЬНОЙ НОВЕЛЛЫ НЕ ИМЕЮТ К ДАННОМУ ПРОЕКТУ НИКАКОГО ОТНОШЕНИЯ!', | ||
}, | ||
authorsDescription: { | ||
'en-US': 'All audiovisual intellectual property belongs to the author of the visual novel:', | ||
'ru-RU': 'Вся аудиовизуальная интеллектуальная собственность принадлежит автору визуальной новеллы:', | ||
}, | ||
authorsSubdescription: { | ||
'en-US': '"IP Startsev Anton Yurievich"', | ||
'ru-RU': '"ИП Старцев Антон Юрьевич"', | ||
}, | ||
authorNovelButtonLink: { | ||
'en-US': 'Link to the author of the visual novel:', | ||
'ru-RU': 'Ссылка на автора визуальной новеллы:', | ||
}, | ||
authorProjectButtonLink: { | ||
'en-US': 'Link to the developer of this project:', | ||
'ru-RU': 'Ссылка на разаботчика этого проекта:', | ||
}, | ||
rulesSubtitle: { | ||
'en-US': 'RULES OF THE GAME', | ||
'ru-RU': 'ПРАВИЛА ИГРЫ', | ||
}, | ||
rulesTitle: { | ||
'en-US': 'About the game', | ||
'ru-RU': 'Об игре', | ||
}, | ||
rulesDescription1: { | ||
'en-US': 'This is a classic card game called "21 points". There are 11 cards in the deck, with values ranging from 2 to 11. The player must score more points than the opponent, but not more than 21.', | ||
'ru-RU': 'Это классическая карточная игра "21 очко". В колоде имеется 11 карт номиналом от 2 до 11. Игроку необходимо набрать больше очков, чем у оппонента, но не более 21.', | ||
}, | ||
rulesDescription2: { | ||
'en-US': 'If a player or a player and an opponent score more than 21 points, they are automatically considered losers.', | ||
'ru-RU': 'Если игрок или игрок и оппонент набрали более 21 очка, они автоматически считаются проигравшими.', | ||
}, | ||
rulesDescription3: { | ||
'en-US': 'If both the player and the opponent score more than 21 points, or they both score the same number of points, the game ends in a draw.', | ||
'ru-RU': 'Если и игрок и оппонент набрали более 21 очка, либо они оба набрали одинаковое количество очков, игра заканчивается ничьей.', | ||
}, | ||
moreTventyOne: { | ||
'en-US': 'You have 21 or more points. You cannot take more cards. Pass the turn to your opponent.', | ||
'ru-RU': 'У Вас равно или более 21 очка. Больше карт взять нельзя. Передайте ход оппоненту.', | ||
}, | ||
nextStepButton: { | ||
'en-US': 'Pass the move', | ||
'ru-RU': 'Передать ход', | ||
}, | ||
getCardButton: { | ||
'en-US': 'Take a card', | ||
'ru-RU': 'Взять карту', | ||
}, | ||
endGameButton: { | ||
'en-US': 'Show cards', | ||
'ru-RU': 'Вскрыть карты', | ||
}, | ||
sum: { | ||
'en-US': 'Sum', | ||
'ru-RU': 'Сумма', | ||
}, | ||
gameStage: { | ||
'en-US': 'Game stage:', | ||
'ru-RU': 'Стадия игры:', | ||
}, | ||
cardsAvailable: { | ||
'en-US': 'Cards remaining:', | ||
'ru-RU': 'Осталось карт:', | ||
}, | ||
cardsUnits: { | ||
'en-US': 'pcs.', | ||
'ru-RU': 'шт.', | ||
}, | ||
gameResults: { | ||
'en-US': 'GAME RESULTS', | ||
'ru-RU': 'РЕЗУЛЬТАТЫ ИГРЫ', | ||
}, | ||
repeatGameButton: { | ||
'en-US': 'Repeat the game', | ||
'ru-RU': 'Повторить игру', | ||
}, | ||
goHomeButton: { | ||
'en-US': 'Go home', | ||
'ru-RU': 'На главную', | ||
}, | ||
playerWinnerTitle: { | ||
'en-US': 'Win!', | ||
'ru-RU': 'Победа!', | ||
}, | ||
playerWinnerDescription: { | ||
'en-US': 'You beat the forest master! Want to play again?', | ||
'ru-RU': 'Вы обыграли хозяниа леса! Хотите повторить игру?', | ||
}, | ||
opponentWinnerTitle: { | ||
'en-US': 'Lose', | ||
'ru-RU': 'Поражение', | ||
}, | ||
opponentWinnerDescription: { | ||
'en-US': 'The forest master has beaten you! Do you want to play again?', | ||
'ru-RU': 'Хозяин леса обыграл Вас! Хотите повторить игру?', | ||
}, | ||
drawWinnerTitle: { | ||
'en-US': 'Draw', | ||
'ru-RU': 'Ничья', | ||
}, | ||
drawWinnerDescription: { | ||
'en-US': 'There is no winner in this game! Do you want to play again?', | ||
'ru-RU': 'В данной партии нет победителя! Хотите повторить игру?', | ||
}, | ||
emptyTranslate: { | ||
'en-US': '', | ||
'ru-RU': '', | ||
}, | ||
playerStep: { | ||
'en-US': 'Player step', | ||
'ru-RU': 'Ход игрока', | ||
}, | ||
opponentStep: { | ||
'en-US': 'Opponent step', | ||
'ru-RU': 'Ход оппонента', | ||
}, | ||
endGameStep: { | ||
'en-US': 'Show results', | ||
'ru-RU': 'Показ результатов', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { useSelector } from "react-redux"; | ||
import { TAvailableLanguages, TSettingsSliceStore } from "../model"; | ||
import { TRANSLATES } from "./translates"; | ||
|
||
type TResponse = { | ||
currentLanguage: TAvailableLanguages; | ||
t: (key: string) => string; | ||
} | ||
|
||
export const useTranslates = (): TResponse => { | ||
const currentLanguage = useSelector<TSettingsSliceStore>((state) => state.sound.currentLanguage) as TAvailableLanguages; | ||
|
||
const t = (key: string): string => { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const keyset = (TRANSLATES as any)[key]; | ||
if (keyset[currentLanguage]) { | ||
return keyset[currentLanguage]; | ||
} else { | ||
return keyset['ru-RU']; | ||
} | ||
}; | ||
|
||
return { | ||
currentLanguage, | ||
t | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export { setActivateSound, default as settingsReducer } from './settings.slice'; | ||
export { changeCurrentLangugage, setActivateSound, default as settingsReducer } from './settings.slice'; | ||
export type { TSettingsSliceState } from './settings.slice'; | ||
export type { TSettingsSliceStore } from './types'; | ||
export type { TAvailableLanguages, TSettingsSliceStore } from './types'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.