mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 15:32:18 +02:00
Add localisation and french locale to login menu
This commit is contained in:
parent
71f99da38d
commit
923aea0c64
@ -13,6 +13,15 @@ export const menu: SimpleTranslationEntries = {
|
||||
"newGame": "New Game",
|
||||
"selectGameMode": "Select a game mode.",
|
||||
"logInOrCreateAccount": "Log in or create an account to start. No email required!",
|
||||
"username": "Username",
|
||||
"password": "Password",
|
||||
"login": "Login",
|
||||
"register": "Register",
|
||||
"emptyUsername": "Username must not be empty",
|
||||
"invalidUsername": "The provided username is invalid",
|
||||
"invalidPassword": "The provided password is invalid",
|
||||
"accountNonExistent": "The provided user does not exist",
|
||||
"unmatchingPassword": "The provided password does not match",
|
||||
"failedToLoadSaveData": "Failed to load save data. Please reload the page.\nIf this continues, please contact the administrator.",
|
||||
"sessionSuccess": "Session loaded successfully.",
|
||||
"failedToLoadSession": "Your session data could not be loaded.\nIt may be corrupted.",
|
||||
|
@ -8,6 +8,15 @@ export const menu: SimpleTranslationEntries = {
|
||||
"newGame": "Nouvelle partie",
|
||||
"selectGameMode": "Sélectionnez un mode de jeu.",
|
||||
"logInOrCreateAccount": "Connectez-vous ou créez un compte pour commencer. Aucun e-mail requis !",
|
||||
"username": "Nom d'utilisateur",
|
||||
"password": "Mot de passe",
|
||||
"login": "Connexion",
|
||||
"register": "S'inscrire",
|
||||
"emptyUsername": "Le nom d'utilisateur ne doit pas être vide",
|
||||
"invalidUsername": "Le nom d'utilisateur n'est pas valide",
|
||||
"invalidPassword": "Le mot de passe n'est pas valide",
|
||||
"accountNonExistent": "Le nom d'utilisateur n'existe pas",
|
||||
"unmatchingPassword": "Le mot de passe n'est pas correct",
|
||||
"failedToLoadSaveData": "Échec du chargement des données. Veuillez recharger la page.\nSi cela continue, veuillez contacter l'administrateur.",
|
||||
"sessionSuccess": "Session chargée avec succès.",
|
||||
"failedToLoadSession": "Vos données de session n'ont pas pu être chargées.\nElles pourraient être corrompues.",
|
||||
|
@ -2,14 +2,15 @@ import { FormModalUiHandler } from "./form-modal-ui-handler";
|
||||
import { ModalConfig } from "./modal-ui-handler";
|
||||
import * as Utils from "../utils";
|
||||
import { Mode } from "./ui";
|
||||
import i18next from '../plugins/i18n';
|
||||
|
||||
export default class LoginFormUiHandler extends FormModalUiHandler {
|
||||
getModalTitle(config?: ModalConfig): string {
|
||||
return 'Login';
|
||||
return i18next.t('menu:login');
|
||||
}
|
||||
|
||||
getFields(config?: ModalConfig): string[] {
|
||||
return [ 'Username', 'Password' ];
|
||||
return [ i18next.t('menu:username'), i18next.t('menu:password') ];
|
||||
}
|
||||
|
||||
getWidth(config?: ModalConfig): number {
|
||||
@ -21,7 +22,7 @@ export default class LoginFormUiHandler extends FormModalUiHandler {
|
||||
}
|
||||
|
||||
getButtonLabels(config?: ModalConfig): string[] {
|
||||
return [ 'Log In', 'Register' ];
|
||||
return [ i18next.t('menu:login'), i18next.t('menu:register') ];
|
||||
}
|
||||
|
||||
getReadableErrorMessage(error: string): string {
|
||||
@ -30,13 +31,13 @@ export default class LoginFormUiHandler extends FormModalUiHandler {
|
||||
error = error.slice(0, colonIndex);
|
||||
switch (error) {
|
||||
case 'invalid username':
|
||||
return 'The provided username is invalid';
|
||||
return i18next.t('menu:invalidUsername');
|
||||
case 'invalid password':
|
||||
return 'The provided password is invalid';
|
||||
return i18next.t('menu:invalidPassword');
|
||||
case 'account doesn\'t exist':
|
||||
return 'The provided user does not exist';
|
||||
return i18next.t('menu:accountNonExistent');
|
||||
case 'password doesn\'t match':
|
||||
return 'The provided password does not match';
|
||||
return i18next.t('menu:unmatchingPassword');
|
||||
}
|
||||
|
||||
return super.getReadableErrorMessage(error);
|
||||
@ -57,7 +58,7 @@ export default class LoginFormUiHandler extends FormModalUiHandler {
|
||||
this.scene.ui.playError();
|
||||
};
|
||||
if (!this.inputs[0].text)
|
||||
return onFail('Username must not be empty');
|
||||
return onFail(i18next.t('menu:emptyUsername'));
|
||||
const contentType = 'application/x-www-form-urlencoded';
|
||||
const headers = {
|
||||
'Content-Type': contentType,
|
||||
|
Loading…
Reference in New Issue
Block a user