Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SecretCodes: FR version #2025

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/public/static/locales/fr/ConnectionLost.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"connection_lost": "Connexion perdue",
"trying_to_connect": "Essayer de se connecter..."
"trying_to_connect": "Tentative de reconnexion..."
}
2 changes: 1 addition & 1 deletion web/public/static/locales/fr/LobbyCarousel.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"public_rooms": "Salles publiques",
"new_room": "Nouvelle salle",
"error": "Une erreur s'est produite lors du chargement du lobby. Essayez de recharger.",
"error": "Une erreur s'est produite lors du chargement du lobby. Essayez de recharger la page.",
"no_public_room_available": "Aucune salle publique disponible. Cliquez sur \"<b>Nouvelle salle</b>\" pour en créer une nouvelle !"
}
2 changes: 1 addition & 1 deletion web/public/static/locales/fr/MessagePage.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"go_home": "À la page d'accueil",
"game_not_found": "Jeu introuvable",
"invalid_game_mode": "Mode de jeu invalide",
"connecting": "Connecter...",
"connecting": "Connexion...",
"failed_to_download": "Échec du téléchargement de {{ name }}",
"downloading": "Télécharger {{ name }}"
}
10 changes: 10 additions & 0 deletions web/src/games/secretcodes/Lobby.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,13 @@
.unassigned h3 {
color: black;
}

.controls {
display: flex;
flex-direction: column;
align-items: center;
}

.controls button {
margin: 4px;
}
52 changes: 39 additions & 13 deletions web/src/games/secretcodes/Lobby.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@ interface ILobbyProps {

export function Lobby({ G, ctx, moves, playerID, gameArgs, isHost }: ILobbyProps) {
const { translate } = useCurrentGameTranslation();
const { players } = gameArgs;

const startGame = () => {
moves.startGame();
};
const removePlayersFromTeams = () => {
moves.removePlayersFromTeams();
};
const distributePlayers = () => {
moves.distributePlayers(players);
};

React.useEffect(() => {
if (isLocalGame(gameArgs) && gameCanStart(G, ctx)) {
Expand All @@ -39,8 +46,6 @@ export function Lobby({ G, ctx, moves, playerID, gameArgs, isHost }: ILobbyProps
unassigned: [],
};

const { players } = gameArgs;

for (const playerID in players) {
const item = (
<LobbyPlayer key={playerID} G={G} moves={moves} playerID={playerID} players={players} isHost={isHost} />
Expand Down Expand Up @@ -80,17 +85,38 @@ export function Lobby({ G, ctx, moves, playerID, gameArgs, isHost }: ILobbyProps

{!gameCanStart(G, ctx) ? <p className={css.text}>{translate('in_order_to_start')}</p> : null}

{isHost ? (
<Button
style={{ float: 'right' }}
variant="contained"
onClick={startGame}
color="primary"
disabled={!gameCanStart(G, ctx)}
>
{translate('play')}
</Button>
) : null}
<div className={css.controls}>
{isHost ? (
<Button
onClick={removePlayersFromTeams}
color="primary"
variant="contained"
>
{translate('removePlayersFromTeams')}
</Button>
) : null}

{isHost ? (
<Button
onClick={distributePlayers}
color="primary"
variant="contained"
>
{translate('distributePlayers')}
</Button>
) : null}

{isHost ? (
<Button
onClick={startGame}
color="primary"
variant="contained"
disabled={!gameCanStart(G, ctx)}
>
{translate('play')}
</Button>
) : null}
</div>
</div>
);
}
4 changes: 2 additions & 2 deletions web/src/games/secretcodes/LobbyPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ export function LobbyPlayer({ G, moves, playerID, players, isHost }: ILobbyPlaye
moves.makeSpymaster(playerID);
};

const isPlayerInTeam = (): boolean => {
const isPlayerAssignedToATeam = (): boolean => {
return getPlayerTeam(G, playerID) !== undefined;
};

return (
<li>
{isPlayerSpymaster(G, playerID) ? <span>{translate('s')}</span> : ''}
{players[playerID].name}
{!isPlayerSpymaster(G, playerID) && isHost && isPlayerInTeam() ? (
{isHost && !isPlayerSpymaster(G, playerID) && isPlayerAssignedToATeam() ? (
<button className={[css.btn, css.btnSpymaster].join(' ')} onClick={() => makeSpymaster(playerID)}>
{translate('make_spymaster')}
</button>
Expand Down
2 changes: 1 addition & 1 deletion web/src/games/secretcodes/PlayBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class PlayBoardInternal extends React.Component<IPlayBoardInnerProps & IP
let spymasterInstructions;
if (this.props.gameArgs.mode === GameMode.OnlineFriend) {
const spymasterName = this.props.gameArgs.players[this._currentPlayerTeam().spymasterID].name;
spymasterInstructions = <>{this.props.translate('spymaster_give_clue', { name: spymasterName })}</>;
spymasterInstructions = <Trans t={this.props.translate} i18nKey="spymaster_give_clue" components={{ name: spymasterName, strong: <strong /> }} />;
}

instruction = (
Expand Down
Loading