Implementation of the translation system for installation process

This commit is contained in:
Nicolas Villa
2014-01-20 07:55:24 +01:00
parent b7fc2fc0e5
commit 9056c725c7
9 changed files with 126 additions and 36 deletions

View File

@@ -0,0 +1,34 @@
<?php
return array(
'Administrator login :' => 'Administrator login :',
'Administrator password :' => 'Administrator password :',
'Administrator password verification :' => 'Administrator password verification :',
'Checking permissions' => 'Checking permissions',
'Choose your database' => 'Choose your database',
'Company name :' => 'Company name :',
'Contact email :' => 'Contact email :',
'Continue' => 'Continue',
'Create an other database' => 'Create an other database',
'Database connection' => 'Database connection',
'Database selection' => 'Database selection',
'Don\'t forget to delete the web/install directory.' => 'Don\'t forget to delete the web/install directory.',
'General information' => 'General information',
'Go to back office' => 'Go to back office',
'Host :' => 'Host :',
'or' => 'or',
'Password :' => 'Password :',
'Port :' => 'Port :',
'Select below the one you want to use.' => 'Select below the one you want to use.',
'Thanks' => 'Thanks',
'Thanks, you have installed Thelia' => 'Thanks, you have installed Thelia',
'Thelia installation wizard' => 'Thelia installation wizard',
'The SQL server contains multiple databases.' => 'The SQL server contains multiple databases.',
'Username :' => 'Username :',
'Version undefined' => 'Version undefined',
'website url :' => 'website url :',
'Welcome' => 'Welcome',
'Welcome in the Thelia installation wizard.' => 'Welcome in the Thelia installation wizard.',
'We will guide you throughout this process to install any application on your system.' => 'We will guide you throughout this process to install any application on your system.',
'Wrong connection information' => 'Wrong connection information'
);

34
web/install/I18n/fr_FR.php Executable file
View File

@@ -0,0 +1,34 @@
<?php
return array(
'Administrator login :' => 'Identifiant administrateur :',
'Administrator password :' => 'Mot de passe administrateur :',
'Administrator password verification :' => 'Vérification mot de passe administrateur :',
'Checking permissions' => 'Permissions',
'Choose your database' => 'Choissisez la base de donnée',
'Company name :' => 'Nom de la société :',
'Contact email :' => 'Email de contact :',
'Continue' => 'Continuez',
'Create an other database' => 'Créez une nouvelle base de donnée',
'Database connection' => 'Base de donnée',
'Database selection' => 'Sélectionnez la base de donnée',
'Don\'t forget to delete the web/install directory.' => 'N\'oubliez d\'enlever le répertoire web/install.',
'General information' => 'Information générale',
'Go to back office' => 'Allez dans l\'interface d\'administration',
'Host :' => 'Hôte :',
'or' => 'ou',
'Password :' => 'Mot de passe :',
'Port :' => 'Port :',
'Select below the one you want to use.' => 'Sélectionnez ci-dessous celle que vous souhaitez utiliser.',
'Thanks' => 'Merci',
'Thanks, you have installed Thelia' => 'Merci, d\'avoir installé Thélia',
'Thelia installation wizard' => 'Gestionnaire d\'installation de Thélia',
'The SQL server contains multiple databases.' => 'Le serveur SQL contient plusieurs databases.',
'Username :' => 'Utilisateur :',
'Version undefined' => 'Version non définie',
'website url :' => 'Url du site :',
'Welcome' => 'Bienvenue',
'Welcome in the Thelia installation wizard.' => 'Bienvenue dans le gestionnaire d\'installation de Thélia.',
'We will guide you throughout this process to install any application on your system.' => 'Nous allons vous guidez pour installer Thélia sur votre système.',
'Wrong connection information' => 'Mauvaise information de connexion'
);

View File

@@ -53,10 +53,10 @@ $databases = $connection->query('show databases');
<div class="well"> <div class="well">
<form action="config.php" method="post"> <form action="config.php" method="post">
<fieldset> <fieldset>
<legend>Choose your database</legend> <legend><?php echo $trans->trans('Choose your database'); ?></legend>
<p> <p>
The SQL server contains multiple databases.<br/> <?php echo $trans->trans('The SQL server contains multiple databases.'); ?><br/>
Select below the one you want to use. <?php echo $trans->trans('Select below the one you want to use.'); ?>
</p> </p>
<?php foreach($databases as $database): ?> <?php foreach($databases as $database): ?>
<?php if ($database['Database'] == 'information_schema') continue; ?> <?php if ($database['Database'] == 'information_schema') continue; ?>
@@ -93,12 +93,12 @@ $databases = $connection->query('show databases');
if($permissions->fetchColumn(0) > 0) { if($permissions->fetchColumn(0) > 0) {
?> ?>
<p> <p>
or <?php echo $trans->trans('or'); ?>
</p> </p>
<div class="radio"> <div class="radio">
<label> <label>
Create an other database <?php echo $trans->trans('Create an other database'); ?>
</label> </label>
</div> </div>
@@ -109,7 +109,7 @@ $databases = $connection->query('show databases');
</fieldset> </fieldset>
<div class="clearfix"> <div class="clearfix">
<div class="control-btn"> <div class="control-btn">
<button type="submit" class="pull-right btn btn-default btn-primary">Continue</button> <button type="submit" class="pull-right btn btn-default btn-primary"><?php echo $trans->trans('Continue'); ?></button>
</div> </div>
</div> </div>

View File

@@ -81,32 +81,32 @@ $website_url = preg_replace("#/install/[a-z](.*)#" ,'', $url);
<form action="end.php" method="POST" > <form action="end.php" method="POST" >
<div class="well"> <div class="well">
<div class="form-group"> <div class="form-group">
<label for="admin_login">Administrator login :</label> <label for="admin_login"><?php echo $trans->trans('Administrator login :'); ?></label>
<input id="admin_login" class="form-control" type="text" name="admin_login" placeholder="admin" value="" required> <input id="admin_login" class="form-control" type="text" name="admin_login" placeholder="admin" value="" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="admin_password">Administrator password :</label> <label for="admin_password"><?php echo $trans->trans('Administrator password :'); ?></label>
<input id="admin_password" class="form-control" type="password" name="admin_password" value="" required> <input id="admin_password" class="form-control" type="password" name="admin_password" value="" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="admin_password_verif">Administrator password verification :</label> <label for="admin_password_verif"><?php echo $trans->trans('Administrator password verification :'); ?></label>
<input id="admin_password_verif" class="form-control" type="password" name="admin_password_verif" value="" required> <input id="admin_password_verif" class="form-control" type="password" name="admin_password_verif" value="" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="email_contact">Contact email :</label> <label for="email_contact"><?php echo $trans->trans('Contact email :'); ?></label>
<input id="email_contact" class="form-control" type="text" name="store_email" placeholder="foo@bar.com" value="" required> <input id="email_contact" class="form-control" type="text" name="store_email" placeholder="foo@bar.com" value="" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="site_name">Company name :</label> <label for="site_name"><?php echo $trans->trans('Company name :'); ?></label>
<input id="site_name" class="form-control" type="text" name="store_name" placeholder="" value="" required> <input id="site_name" class="form-control" type="text" name="store_name" placeholder="" value="" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="site_name">website url :</label> <label for="site_name"><?php echo $trans->trans('website url :'); ?></label>
<input id="site_name" class="form-control" type="text" name="url_site" placeholder="" value="http://<?php echo $_SERVER['SERVER_NAME'].$website_url; ?>" required> <input id="site_name" class="form-control" type="text" name="url_site" placeholder="" value="http://<?php echo $_SERVER['SERVER_NAME'].$website_url; ?>" required>
</div> </div>
<div class="clearfix"> <div class="clearfix">
<div class="control-btn"> <div class="control-btn">
<button type="submit" class="pull-right btn btn-default btn-primary">Continue</button> <button type="submit" class="pull-right btn btn-default btn-primary"><?php echo $trans->trans('Continue'); ?></button>
</div> </div>
</div> </div>

View File

@@ -32,25 +32,25 @@ $_SESSION['install']['step'] = 3;
<form action="bdd.php" method="POST" > <form action="bdd.php" method="POST" >
<?php if(isset($_GET['err']) && $_GET['err'] == 1){ ?> <?php if(isset($_GET['err']) && $_GET['err'] == 1){ ?>
<div class="alert alert-danger">Wrong connection information</div> <div class="alert alert-danger"><?php echo $trans->trans('Wrong connection information'); ?></div>
<?php } ?> <?php } ?>
<div class="well"> <div class="well">
<div class="form-group"> <div class="form-group">
<label for="host">Host :</label> <label for="host"><?php echo $trans->trans('Host :'); ?></label>
<input id="host" class="form-control" type="text" name="host" placeholder="localhost" value="<?php if(isset($_SESSION['install']['host'])){ echo $_SESSION['install']['host']; } ?>"> <input id="host" class="form-control" type="text" name="host" placeholder="localhost" value="<?php if(isset($_SESSION['install']['host'])){ echo $_SESSION['install']['host']; } ?>">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="user">Username :</label> <label for="user"><?php echo $trans->trans('Username :'); ?></label>
<input id="user" type="text" class="form-control" name="username" placeholder="john" value="<?php if(isset($_SESSION['install']['username'])){ echo $_SESSION['install']['username']; } ?>"> <input id="user" type="text" class="form-control" name="username" placeholder="john" value="<?php if(isset($_SESSION['install']['username'])){ echo $_SESSION['install']['username']; } ?>">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="password">Password :</label> <label for="password"><?php echo $trans->trans('Password :'); ?></label>
<input id="password" type="password" class="form-control" name="password" placeholder="l33t 5p34k" > <input id="password" type="password" class="form-control" name="password" placeholder="l33t 5p34k" >
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="port">Port :</label> <label for="port"><?php echo $trans->trans('Port :'); ?></label>
<input id="port" type="text" class="form-control" name="port" value="<?php if(isset($_SESSION['install']['port'])){ echo $_SESSION['install']['port']; } else { echo '3306'; } ?>"> <input id="port" type="text" class="form-control" name="port" value="<?php if(isset($_SESSION['install']['port'])){ echo $_SESSION['install']['port']; } else { echo '3306'; } ?>">
</div> </div>
@@ -58,7 +58,7 @@ $_SESSION['install']['step'] = 3;
<div class="clearfix"> <div class="clearfix">
<div class="control-btn"> <div class="control-btn">
<button type="submit" class="pull-right btn btn-default btn-primary">Continue</button> <button type="submit" class="pull-right btn btn-default btn-primary"><?php echo $trans->trans('Continue'); ?></button>
</div> </div>
</div> </div>

View File

@@ -67,14 +67,14 @@ $website_url = preg_replace("#/install/[a-z](.*)#" ,'', $url);
<div class="well"> <div class="well">
<p class="lead text-center"> <p class="lead text-center">
Thanks, you have installed Thelia <?php echo $trans->trans('Thanks, you have installed Thelia'); ?>
</p> </p>
<p class="lead text-center"> <p class="lead text-center">
Don't forget to delete the web/install directory. <?php echo $trans->trans('Don\'t forget to delete the web/install directory.'); ?>
</p> </p>
<p class="lead text-center"> <p class="lead text-center">
<a href="<?php echo $request->getSchemeAndHttpHost().$website_url; ?>/admin">Go to back office</a> <a href="<?php echo $request->getSchemeAndHttpHost().$website_url; ?>/admin"><?php echo $trans->trans('Go to back office'); ?></a>
</p> </p>
</div> </div>

View File

@@ -22,6 +22,21 @@
/*************************************************************************************/ /*************************************************************************************/
session_start(); session_start();
include 'bootstrap.php'; include 'bootstrap.php';
use Symfony\Component\Translation\Translator;
$_SESSION['install']['lang'] = "en_US";
if($_REQUEST['lang']){
$_SESSION['install']['lang'] = $_REQUEST['lang'];
}
$trans = new Translator();
$trans->setLocale($_SESSION['install']['lang']);
$trans->addLoader("php", new Symfony\Component\Translation\Loader\PhpFileLoader());
$trans->addResource('php', __DIR__.'/I18n/'.$_SESSION['install']['lang'].'.php', $_SESSION['install']['lang']);
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang=""> <html lang="">
@@ -29,14 +44,16 @@ include 'bootstrap.php';
<title>Installation</title> <title>Installation</title>
<link rel="shortcut icon" href="fd33fd0-6fda040.ico" /> <link rel="shortcut icon" href="fd33fd0-6fda040.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css"> <link rel="stylesheet" href="styles.css">
</head> </head>
<body> <body>
<div class="topbar"> <div class="topbar">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<div class="version-info">Version undefined</div> <div class="version-info"><?php echo $trans->trans('Version undefined'); ?></div>
</div> </div>
</div> </div>
</div> </div>
@@ -46,14 +63,14 @@ include 'bootstrap.php';
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="general-block-decorator"> <div class="general-block-decorator">
<h3 class="title title-without-tabs">Thelia installation wizard</h3> <h3 class="title title-without-tabs"><?php echo $trans->trans('Thelia installation wizard'); ?></h3>
<div class="wizard"> <div class="wizard">
<ul> <ul>
<li class="<?php if($step == 1){ echo 'active'; } elseif ($step > 1) { echo 'complete'; }?>"><span class="badge">1</span>Welcome<span class="chevron"></span></li> <li class="<?php if($step == 1){ echo 'active'; } elseif ($step > 1) { echo 'complete'; }?>"><span class="badge">1</span><?php echo $trans->trans('Welcome'); ?><span class="chevron"></span></li>
<li class="<?php if($step == 2){ echo 'active'; } elseif ($step > 2) { echo 'complete'; }?>"><span class="badge">2</span>Checking permissions<span class="chevron"></span></li> <li class="<?php if($step == 2){ echo 'active'; } elseif ($step > 2) { echo 'complete'; }?>"><span class="badge">2</span><?php echo $trans->trans('Checking permissions'); ?><span class="chevron"></span></li>
<li class="<?php if($step == 3){ echo 'active'; } elseif ($step > 3) { echo 'complete'; }?>"><span class="badge">3</span>Database connection<span class="chevron"></span></li> <li class="<?php if($step == 3){ echo 'active'; } elseif ($step > 3) { echo 'complete'; }?>"><span class="badge">3</span><?php echo $trans->trans('Database connection'); ?><span class="chevron"></span></li>
<li class="<?php if($step == 4){ echo 'active'; } elseif ($step > 4) { echo 'complete'; }?>"><span class="badge">4</span>Database selection<span class="chevron"></span></li> <li class="<?php if($step == 4){ echo 'active'; } elseif ($step > 4) { echo 'complete'; }?>"><span class="badge">4</span><?php echo $trans->trans('Database selection'); ?><span class="chevron"></span></li>
<li class="<?php if($step == 5){ echo 'active'; } elseif ($step > 5) { echo 'complete'; }?>"><span class="badge">5</span>General information<span class="chevron"></span></li> <li class="<?php if($step == 5){ echo 'active'; } elseif ($step > 5) { echo 'complete'; }?>"><span class="badge">5</span><?php echo $trans->trans('General information'); ?><span class="chevron"></span></li>
<li class="<?php if($step == 6){ echo 'active'; } elseif ($step > 6) { echo 'complete'; }?>"><span class="badge">6</span>Thanks<span class="chevron"></span></li> <li class="<?php if($step == 6){ echo 'active'; } elseif ($step > 6) { echo 'complete'; }?>"><span class="badge">6</span><?php echo $trans->trans('Thanks'); ?><span class="chevron"></span></li>
</ul> </ul>
</div> </div>

View File

@@ -26,14 +26,19 @@
include("header.php"); include("header.php");
?> ?>
<div class="well"> <div class="well">
<div class="clearfix">
<a href="?lang=fr_FR"><span class="glyphicon glyphicon-chevron-right"></span> <?php echo $trans->trans('French'); ?></a>
<a href="?lang=en_US"><span class="glyphicon glyphicon-chevron-right"></span> <?php echo $trans->trans('English'); ?></a>
</div>
<p class="lead text-center"> <p class="lead text-center">
Welcome in the Thelia installation wizard. <?php echo $trans->trans('Welcome in the Thelia installation wizard.'); ?>
</p> </p>
<p class="text-center"> <p class="text-center">
We will guide you throughout this process to install any application on your system. <?php echo $trans->trans('We will guide you throughout this process to install any application on your system.'); ?>
</p> </p>
</div> </div>
<div class="clearfix"> <div class="clearfix">
<a href="permission.php" class="pull-right btn btn-default btn-primary"><span class="glyphicon glyphicon-chevron-right"></span> Continue</a> <a href="permission.php" class="pull-right btn btn-default btn-primary"><span class="glyphicon glyphicon-chevron-right"></span> <?php echo $trans->trans('Continue'); ?></a>
</div> </div>
<?php include("footer.php"); ?> <?php include("footer.php"); ?>

View File

@@ -35,7 +35,7 @@ $_SESSION['install']['current_step'] = 'permission.php';
$_SESSION['install']['step'] = 2; $_SESSION['install']['step'] = 2;
?> ?>
<div class="well"> <div class="well">
<p>Checking permissions</p> <p><?php echo $trans->trans('Checking permissions'); ?></p>
<ul class="list-unstyled list-group"> <ul class="list-unstyled list-group">
<?php foreach($validationMessage as $item => $data): ?> <?php foreach($validationMessage as $item => $data): ?>
<li class="list-group-item <?php if ($data['status']) {echo 'text-success';} else { echo 'text-danger';} ?>"> <li class="list-group-item <?php if ($data['status']) {echo 'text-success';} else { echo 'text-danger';} ?>">
@@ -48,7 +48,7 @@ $_SESSION['install']['step'] = 2;
</div> </div>
<div class="clearfix"> <div class="clearfix">
<?php if($isValid){ ?> <?php if($isValid){ ?>
<a href="connection.php" class="pull-right btn btn-default btn-primary"><span class="glyphicon glyphicon-chevron-right"></span> Continue</a> <a href="connection.php" class="pull-right btn btn-default btn-primary"><span class="glyphicon glyphicon-chevron-right"></span> <?php echo $trans->trans('Continue'); ?></a>
<?php } else { ?> <?php } else { ?>
<a href="permission.php" class="pull-right btn btn-default btn-danger"><span class="glyphicon glyphicon-refresh"></span> refresh</a> <a href="permission.php" class="pull-right btn btn-default btn-danger"><span class="glyphicon glyphicon-refresh"></span> refresh</a>
<?php } ?> <?php } ?>