Procházet zdrojové kódy

L'installateur gère désormais l'internationalisation et détecte la langue préférée de l'utilisateur (fix bug #38)

Marien Fressinaud před 13 roky
rodič
revize
10b9797da7
4 změnil soubory, kde provedl 278 přidání a 59 odebrání
  1. 52 0
      app/i18n/en.php
  2. 52 0
      app/i18n/fr.php
  3. 1 1
      app/models/Category.php
  4. 173 58
      public/install.php

+ 52 - 0
app/i18n/en.php

@@ -51,6 +51,7 @@ return array (
 	'error_occurred'		=> 'An error occured',
 	'error_occurred_update'		=> 'An error occured during update',
 
+	'default_category'		=> 'Uncategorized',
 	'categories_updated'		=> 'Categories have been updated',
 	'categories_management'		=> 'Categories management',
 	'feed_updated'			=> 'Feed has been updated',
@@ -214,4 +215,55 @@ return array (
 	// format for date() function, %s allows to indicate month in letter
 	'format_date'			=> '%s dS Y',
 	'format_date_hour'		=> '%s dS Y \a\t H\.i',
+
+	// INSTALLATION
+	'freshrss_installation'		=> 'Installation - FreshRSS',
+	'freshrss'			=> 'FreshRSS',
+	'installation_step'		=> 'Installation - step %d',
+	'steps'				=> 'Steps',
+	'checks'			=> 'Checks',
+	'bdd_configuration'		=> 'Database configuration',
+	'this_is_the_end'		=> 'This is the end',
+
+	'ok'				=> 'Ok!',
+	'congratulations'		=> 'Congratulations!',
+	'attention'			=> 'Attention!',
+	'damn'				=> 'Damn!',
+	'oops'				=> 'Oops!',
+	'next_step'			=> 'Go to the next step',
+
+	'language_defined'		=> 'Language has been defined.',
+	'choose_language'		=> 'Choose a language for FreshRSS',
+
+	'javascript_is_better'		=> 'FreshRSS is more pleasant with Javascript enabled',
+	'php_is_ok'			=> 'Your PHP version is %s and it\'s compatible with FreshRSS',
+	'php_is_nok'			=> 'Your PHP version is %s. You must have at least version %s',
+	'minz_is_ok'			=> 'You have Minz framework',
+	'minz_is_nok'			=> 'You haven\'t Minz framework. You should execute <em>build.sh</em> script or <a href="https://github.com/marienfressinaud/MINZ">download it on Github</a> and install in <em>%s</em> directory the content of its <em>/lib</em> directory.',
+	'curl_is_ok'			=> 'You have version %s of cURL',
+	'curl_is_nok'			=> 'You haven\'t cURL',
+	'pdomysql_is_ok'		=> 'You have PDO and its driver for MySQL',
+	'pdomysql_is_nok'		=> 'You haven\'t PDO or its driver for MySQL',
+	'cache_is_ok'			=> 'Permissions on cache directory are good',
+	'log_is_ok'			=> 'Permissions on logs directory are good',
+	'conf_is_ok'			=> 'Permissions on configuration directory are good',
+	'data_is_ok'			=> 'Permissions on data directory are good',
+	'file_is_nok'			=> 'Check permissions on <em>%s</em> directory. HTTP server must have rights to write into',
+	'fix_errors_before'		=> 'Fix errors before skip to the next step.',
+
+	'general_conf_is_ok'		=> 'General configuration has been saved.',
+	'random_string'			=> 'Random string',
+	'change_value'			=> 'You should change this value by any other',
+	'base_url'			=> 'Base URL',
+	'do_not_change_if_doubt'	=> 'Don\'t change if you doubt about it',
+
+	'bdd_conf_is_ok'		=> 'Database configuration has been saved.',
+	'host'				=> 'Host',
+	'username'			=> 'Username',
+	'password'			=> 'Password',
+	'bdd'				=> 'Database',
+
+	'installation_is_ok'		=> 'Installation process is finished. You must delete <em>install.php</em> file to access FreshRSS... or simply click on following button :)',
+	'finish_installation'		=> 'Finish installation',
+	'install_not_deleted'		=> 'Something was going wrong, you muste delete <em>%s</em> file manually.',
 );

+ 52 - 0
app/i18n/fr.php

@@ -51,6 +51,7 @@ return array (
 	'error_occurred'		=> 'Une erreur est survenue',
 	'error_occurred_update'		=> 'Une erreur est survenue lors de la mise à jour',
 
+	'default_category'		=> 'Sans catégorie',
 	'categories_updated'		=> 'Les catégories ont été mises à jour',
 	'categories_management'		=> 'Gestion des catégories',
 	'feed_updated'			=> 'Le flux a été mis à jour',
@@ -214,4 +215,55 @@ return array (
 	// format pour la fonction date(), %s permet d'indiquer le mois en toutes lettres
 	'format_date'			=> 'd %s Y',
 	'format_date_hour'		=> '\l\e d %s Y \à H\:i',
+
+	// INSTALLATION
+	'freshrss_installation'		=> 'Installation - FreshRSS',
+	'freshrss'			=> 'FreshRSS',
+	'installation_step'		=> 'Installation - étape %d',
+	'steps'				=> 'Étapes',
+	'checks'			=> 'Vérifications',
+	'bdd_configuration'		=> 'Configuration de la base de données',
+	'this_is_the_end'		=> 'This is the end',
+
+	'ok'				=> 'Ok !',
+	'congratulations'		=> 'Félicitations !',
+	'attention'			=> 'Attention !',
+	'damn'				=> 'Arf !',
+	'oops'				=> 'Oups !',
+	'next_step'			=> 'Passer à l\'étape suivante',
+
+	'language_defined'		=> 'La langue a bien été définie.',
+	'choose_language'		=> 'Choisissez la langue pour FreshRSS',
+
+	'javascript_is_better'		=> 'FreshRSS est plus agréable à utiliser avec le Javascript d\'activé',
+	'php_is_ok'			=> 'Votre version de PHP est la %s et est compatible avec FreshRSS',
+	'php_is_nok'			=> 'Votre version de PHP est la %s. Vous devriez avoir au moins la version %s',
+	'minz_is_ok'			=> 'Vous disposez du framework Minz',
+	'minz_is_nok'			=> 'Vous ne disposez pas de la librairie Minz. Vous devriez exécuter le script <em>build.sh</em> ou bien <a href="https://github.com/marienfressinaud/MINZ">la télécharger sur Github</a> et installer dans le répertoire <em>%s</em> le contenu de son répertoire <em>/lib</em>.',
+	'curl_is_ok'			=> 'Vous disposez de cURL dans sa version %s',
+	'curl_is_nok'			=> 'Vous ne disposez pas de cURL',
+	'pdomysql_is_ok'		=> 'Vous disposez de PDO et de son driver pour MySQL',
+	'pdomysql_is_nok'		=> 'Vous ne disposez pas de PDO ou de son driver pour MySQL',
+	'cache_is_ok'			=> 'Les droits sur le répertoire de cache sont bons',
+	'log_is_ok'			=> 'Les droits sur le répertoire des logs sont bons',
+	'conf_is_ok'			=> 'Les droits sur le répertoire de configuration sont bons',
+	'data_is_ok'			=> 'Les droits sur le répertoire de data sont bons',
+	'file_is_nok'			=> 'Veuillez vérifier les droits sur le répertoire <em>%s</em>. Le serveur HTTP doit être capable d\'écrire dedans',
+	'fix_errors_before'		=> 'Veuillez corriger les erreurs avant de passer à l\'étape suivante.',
+
+	'general_conf_is_ok'		=> 'La configuration générale a été enregistrée.',
+	'random_string'			=> 'Chaîne aléatoire',
+	'change_value'			=> 'Vous devriez changer cette valeur par n\'importe quelle autre',
+	'base_url'			=> 'Base de l\'url',
+	'do_not_change_if_doubt'	=> 'Laissez tel quel dans le doute',
+
+	'bdd_conf_is_ok'		=> 'La configuration de la base de données a été enregistrée.',
+	'host'				=> 'Hôte',
+	'username'			=> 'Nom utilisateur',
+	'password'			=> 'Mot de passe',
+	'bdd'				=> 'Base de données',
+
+	'installation_is_ok'		=> 'L\'installation s\'est bien passée. Il faut maintenant supprimer le fichier <em>install.php</em> pour pouvoir accéder à FreshRSS... ou simplement cliquer sur le bouton ci-dessous :)',
+	'finish_installation'		=> 'Terminer l\'installation',
+	'install_not_deleted'		=> 'Quelque chose s\'est mal passé, vous devez supprimer le fichier <em>%s</em> à la main.',
 );

+ 1 - 1
app/models/Category.php

@@ -176,7 +176,7 @@ class CategoryDAO extends Model_pdo {
 		$def_cat = $this->searchById ('000000');
 
 		if (!$def_cat) {
-			$cat = new Category ('Sans catégorie');
+			$cat = new Category (Translate::t ('default_category'));
 			$cat->_id ('000000');
 
 			$values = array (

+ 173 - 58
public/install.php

@@ -70,7 +70,66 @@ function writeArray ($f, $array) {
 	}
 }
 
+// gestion internationalisation
+$translates = array ();
+$actual = 'en';
+function initTranslate () {
+	global $translates;
+	global $actual;
+
+	$l = getBetterLanguage ('en');
+	if (isset ($_SESSION['language'])) {
+		$l = $_SESSION['language'];
+	}
+	$actual = $l;
+
+	$file = APP_PATH . '/i18n/' . $actual . '.php';
+	if (file_exists ($file)) {
+		$translates = include ($file);
+	}
+}
+function getBetterLanguage ($fallback) {
+	$available = availableLanguages ();
+	$accept = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
+	$language = strtolower (substr ($accept, 0, 2));
+
+	if (isset ($available[$language])) {
+		return $language;
+	} else {
+		return $fallback;
+	}
+}
+function availableLanguages () {
+	return array (
+		'en' => 'English',
+		'fr' => 'Français'
+	);
+}
+function _t ($key) {
+	global $translates;
+	$translate = $key;
+	if (isset ($translates[$key])) {
+		$translate = $translates[$key];
+	}
+
+	$args = func_get_args ();
+	unset($args[0]);
+
+	return vsprintf ($translate, $args);
+}
+
 /*** SAUVEGARDES ***/
+function saveLanguage () {
+	if (!empty ($_POST)) {
+		if (!isset ($_POST['language'])) {
+			return false;
+		}
+
+		$_SESSION['language'] = $_POST['language'];
+
+		header ('Location: index.php?step=1');
+	}
+}
 function saveStep2 () {
 	if (!empty ($_POST)) {
 		if (empty ($_POST['sel']) ||
@@ -95,6 +154,7 @@ function saveStep2 () {
 		writeLine ($f, '<?php');
 		writeLine ($f, 'return array (');
 		writeArray ($f, array (
+			'language' => $_SESSION['language'],
 			'old_entries' => $_SESSION['old_entries'],
 			'mail_login' => $_SESSION['mail_login']
 		));
@@ -149,10 +209,13 @@ function deleteInstall () {
 
 /*** VÉRIFICATIONS ***/
 function checkStep () {
+	$s0 = checkStep0 ();
 	$s1 = checkStep1 ();
 	$s2 = checkStep2 ();
 	$s3 = checkStep3 ();
-	if (STEP > 1 && $s1['all'] != 'ok') {
+	if (STEP > 0 && $s0['all'] != 'ok') {
+		header ('Location: index.php?step=0');
+	} elseif (STEP > 1 && $s1['all'] != 'ok') {
 		header ('Location: index.php?step=1');
 	} elseif (STEP > 2 && $s2['all'] != 'ok') {
 		header ('Location: index.php?step=2');
@@ -160,6 +223,16 @@ function checkStep () {
 		header ('Location: index.php?step=3');
 	}
 }
+function checkStep0 () {
+	$languages = availableLanguages ();
+	$language = isset ($_SESSION['language']) &&
+	            isset ($languages[$_SESSION['language']]);
+
+	return array (
+		'language' => $language ? 'ok' : 'ko',
+		'all' => $language ? 'ok' : 'ko'
+	);
+}
 function checkStep1 () {
 	$php = version_compare (PHP_VERSION, '5.1.0') >= 0;
 	$minz = file_exists (LIB_PATH . '/minz');
@@ -234,64 +307,98 @@ function checkBD () {
 }
 
 /*** AFFICHAGE ***/
+function printStep0 () {
+	global $actual;
+?>
+	<?php $s0 = checkStep0 (); if ($s0['all'] == 'ok') { ?>
+	<p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('language_defined'); ?></p>
+	<?php } ?>
+
+	<form action="index.php?step=0" method="post">
+		<legend><?php echo _t ('choose_language'); ?></legend>
+		<div class="form-group">
+			<label class="group-name" for="language"><?php echo _t ('language'); ?></label>
+			<div class="group-controls">
+				<select name="language" id="language">
+				<?php $languages = availableLanguages (); ?>
+				<?php foreach ($languages as $short => $lib) { ?>
+				<option value="<?php echo $short; ?>"<?php echo $actual == $short ? ' selected="selected"' : ''; ?>><?php echo $lib; ?></option>
+				<?php } ?>
+				</select>
+			</div>
+		</div>
+
+		<div class="form-group form-actions">
+			<div class="group-controls">
+				<button type="submit" class="btn btn-important"><?php echo _t ('save'); ?></button>
+				<button type="reset" class="btn"><?php echo _t ('cancel'); ?></button>
+				<?php if ($s0['all'] == 'ok') { ?>
+				<a class="btn btn-important next-step" href="?step=1"><?php echo _t ('next_step'); ?></a>
+				<?php } ?>
+			</div>
+		</div>
+	</form>
+<?php
+}
+
 function printStep1 () {
 	$res = checkStep1 ();
 ?>
-	<noscript><p class="alert alert-warn"><span class="alert-head">Attention !</span> FreshRSS est plus agréable à utiliser avec le Javascript d'activé</p></noscript>
+	<noscript><p class="alert alert-warn"><span class="alert-head"><?php echo _t ('attention'); ?></span> <?php echo _t ('javascript_is_better'); ?></p></noscript>
 
 	<?php if ($res['php'] == 'ok') { ?>
-	<p class="alert alert-success"><span class="alert-head">Ok !</span> Votre version de PHP est la <?php echo PHP_VERSION; ?> et est compatible avec FreshRSS</p>
+	<p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('php_is_ok', PHP_VERSION); ?></p>
 	<?php } else { ?>
-	<p class="alert alert-error"><span class="alert-head">Arf !</span> Votre version de PHP est la <?php echo PHP_VERSION; ?>. Vous devriez avoir au moins la version 5.1.0</p>
+	<p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('php_is_nok', PHP_VERSION, '5.1.0'); ?></p>
 	<?php } ?>
 
 	<?php if ($res['minz'] == 'ok') { ?>
-	<p class="alert alert-success"><span class="alert-head">Ok !</span> Vous disposez du framework Minz</p>
+	<p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('minz_is_ok'); ?></p>
 	<?php } else { ?>
-	<p class="alert alert-error"><span class="alert-head">Arf !</span> Vous ne disposez pas de la librairie Minz. Vous devriez exécuter le script <em>build.sh</em> ou bien <a href="https://github.com/marienfressinaud/MINZ">la télécharger sur Github</a> et installer dans le répertoire <em><?php echo LIB_PATH . '/minz'; ?></em> le contenu de son répertoire <em>/lib</em>.</p>
+	<p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('minz_is_nok', LIB_PATH . '/minz'); ?></p>
 	<?php } ?>
 
 	<?php $version = curl_version(); ?>
 	<?php if ($res['curl'] == 'ok') { ?>
-	<p class="alert alert-success"><span class="alert-head">Ok !</span> Vous disposez de cURL dans sa version <?php echo $version['version']; ?></p>
+	<p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('curl_is_ok', $version['version']); ?></p>
 	<?php } else { ?>
-	<p class="alert alert-error"><span class="alert-head">Arf !</span> Vous ne disposez pas de cURL</p>
+	<p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('curl_is_nok'); ?></p>
 	<?php } ?>
 
 	<?php if ($res['pdo-mysql'] == 'ok') { ?>
-	<p class="alert alert-success"><span class="alert-head">Ok !</span> Vous disposez de PDO et de son driver pour MySQL</p>
+	<p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('pdomysql_is_ok'); ?></p>
 	<?php } else { ?>
-	<p class="alert alert-error"><span class="alert-head">Arf !</span> Vous ne disposez pas de PDO ou de son driver pour MySQL</p>
+	<p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('pdomysql_is_nok'); ?></p>
 	<?php } ?>
 
 	<?php if ($res['cache'] == 'ok') { ?>
-	<p class="alert alert-success"><span class="alert-head">Ok !</span> Les droits sur le répertoire de cache sont bons</p>
+	<p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('cache_is_ok'); ?></p>
 	<?php } else { ?>
-	<p class="alert alert-error"><span class="alert-head">Arf !</span> Veuillez vérifier les droits sur le répertoire <em><?php echo PUBLIC_PATH . '/../cache'; ?></em>. Le serveur HTTP doit être capable d'écrire dedans</p>
+	<p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('file_is_nok', PUBLIC_PATH . '/../cache'); ?></p>
 	<?php } ?>
 
 	<?php if ($res['log'] == 'ok') { ?>
-	<p class="alert alert-success"><span class="alert-head">Ok !</span> Les droits sur le répertoire des logs sont bons</p>
+	<p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('log_is_ok'); ?></p>
 	<?php } else { ?>
-	<p class="alert alert-error"><span class="alert-head">Arf !</span> Veuillez vérifier les droits sur le répertoire <em><?php echo PUBLIC_PATH . '/../log'; ?></em>. Le serveur HTTP doit être capable d'écrire dedans</p>
+	<p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('file_is_nok', PUBLIC_PATH . '/../log'); ?></p>
 	<?php } ?>
 
 	<?php if ($res['configuration'] == 'ok') { ?>
-	<p class="alert alert-success"><span class="alert-head">Ok !</span> Les droits sur le répertoire de configuration sont bons</p>
+	<p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('conf_is_ok'); ?></p>
 	<?php } else { ?>
-	<p class="alert alert-error"><span class="alert-head">Arf !</span> Veuillez vérifier les droits sur le répertoire <em><?php echo APP_PATH . '/configuration'; ?></em>. Le serveur HTTP doit être capable d'écrire dedans</p>
+	<p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('file_is_nok', APP_PATH . '/configuration'); ?></p>
 	<?php } ?>
 
 	<?php if ($res['data'] == 'ok') { ?>
-	<p class="alert alert-success"><span class="alert-head">Ok !</span> Les droits sur le répertoire de data sont bons</p>
+	<p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('data_is_ok'); ?></p>
 	<?php } else { ?>
-	<p class="alert alert-error"><span class="alert-head">Arf !</span> Veuillez vérifier les droits sur le répertoire <em><?php echo PUBLIC_PATH . '/data'; ?></em>. Le serveur HTTP doit être capable d'écrire dedans</p>
+	<p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('file_is_nok', PUBLIC_PATH . '/data'); ?></p>
 	<?php } ?>
 
 	<?php if ($res['all'] == 'ok') { ?>
-	<a class="btn btn-important next-step" href="?step=2">Passer à l'étape suivante</a>
+	<a class="btn btn-important next-step" href="?step=2"><?php echo _t ('next_step'); ?></a>
 	<?php } else { ?>
-	Veuillez corriger les erreurs avant de passer à l'étape suivante.
+	<p class="alert alert-error"><?php echo _t ('fix_errors_before'); ?></p>
 	<?php } ?>
 <?php
 }
@@ -299,15 +406,15 @@ function printStep1 () {
 function printStep2 () {
 ?>
 	<?php $s2 = checkStep2 (); if ($s2['all'] == 'ok') { ?>
-	<p class="alert alert-success"><span class="alert-head">Ok !</span> La configuration générale a été enregistrée.</p>
+	<p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('general_conf_is_ok'); ?></p>
 	<?php } ?>
 
 	<form action="index.php?step=2" method="post">
-		<legend>Configuration générale</legend>
+		<legend><?php echo _t ('general_configuration'); ?></legend>
 		<div class="form-group">
-			<label class="group-name" for="sel">Chaîne aléatoire</label>
+			<label class="group-name" for="sel"><?php echo _t ('random_string'); ?></label>
 			<div class="group-controls">
-				<input type="text" id="sel" name="sel" value="<?php echo isset ($_SESSION['sel']) ? $_SESSION['sel'] : '123~abcdefghijklmnopqrstuvwxyz~321'; ?>" /> <i class="icon i_help"></i> Vous devriez changer cette valeur par n'importe quelle autre
+				<input type="text" id="sel" name="sel" value="<?php echo isset ($_SESSION['sel']) ? $_SESSION['sel'] : '123~abcdefghijklmnopqrstuvwxyz~321'; ?>" /> <i class="icon i_help"></i> <?php echo _t ('change_value'); ?>
 			</div>
 		</div>
 
@@ -315,40 +422,40 @@ function printStep2 () {
 			$url = substr ($_SERVER['PHP_SELF'], 0, -10);
 		?>
 		<div class="form-group">
-			<label class="group-name" for="base_url">Base de l'url</label>
+			<label class="group-name" for="base_url"><?php echo _t ('base_url'); ?></label>
 			<div class="group-controls">
-				<input type="text" id="base_url" name="base_url" value="<?php echo isset ($_SESSION['base_url']) ? $_SESSION['base_url'] : $url; ?>" /> <i class="icon i_help"></i> Laissez tel quel dans le doute
+				<input type="text" id="base_url" name="base_url" value="<?php echo isset ($_SESSION['base_url']) ? $_SESSION['base_url'] : $url; ?>" /> <i class="icon i_help"></i> <?php echo _t ('do_not_change_if_doubt'); ?>
 			</div>
 		</div>
 
 		<div class="form-group">
-			<label class="group-name" for="title">Titre</label>
+			<label class="group-name" for="title"><?php echo _t ('title'); ?></label>
 			<div class="group-controls">
-				<input type="text" id="title" name="title" value="<?php echo isset ($_SESSION['title']) ? $_SESSION['title'] : 'FreshRSS'; ?>" />
+				<input type="text" id="title" name="title" value="<?php echo isset ($_SESSION['title']) ? $_SESSION['title'] : _t ('freshrss'); ?>" />
 			</div>
 		</div>
 
 		<div class="form-group">
-			<label class="group-name" for="old_entries">Supprimer les articles tous les</label>
+			<label class="group-name" for="old_entries"><?php echo _t ('delete_articles_every'); ?></label>
 			<div class="group-controls">
-				<input type="number" id="old_entries" name="old_entries" value="<?php echo isset ($_SESSION['old_entries']) ? $_SESSION['old_entries'] : '3'; ?>" /> mois
+				<input type="number" id="old_entries" name="old_entries" value="<?php echo isset ($_SESSION['old_entries']) ? $_SESSION['old_entries'] : '3'; ?>" /> <?php echo _t ('month'); ?>
 			</div>
 		</div>
 
 		<div class="form-group">
-			<label class="group-name" for="mail_login">Adresse mail de connexion (utilise <a href="https://persona.org/">Persona</a>)</label>
+			<label class="group-name" for="mail_login"><?php echo _t ('persona_connection_email'); ?></label>
 			<div class="group-controls">
-				<input type="email" id="mail_login" name="mail_login" value="<?php echo isset ($_SESSION['mail_login']) ? $_SESSION['mail_login'] : ''; ?>" placeholder="Laissez vide pour désactiver" />
-				<noscript><b>nécessite que javascript soit activé</b></noscript>
+				<input type="email" id="mail_login" name="mail_login" value="<?php echo isset ($_SESSION['mail_login']) ? $_SESSION['mail_login'] : ''; ?>" placeholder="<?php echo _t ('blank_to_disable'); ?>" />
+				<noscript><b><?php echo _t ('javascript_should_be_activated'); ?></b></noscript>
 			</div>
 		</div>
 
 		<div class="form-group form-actions">
 			<div class="group-controls">
-				<button type="submit" class="btn btn-important">Valider</button>
-				<button type="reset" class="btn">Annuler</button>
+				<button type="submit" class="btn btn-important"><?php echo _t ('save'); ?></button>
+				<button type="reset" class="btn"><?php echo _t ('cancel'); ?></button>
 				<?php if ($s2['all'] == 'ok') { ?>
-				<a class="btn btn-important next-step" href="?step=3">Passer à l'étape suivante</a>
+				<a class="btn btn-important next-step" href="?step=3"><?php echo _t ('next_step'); ?></a>
 				<?php } ?>
 			</div>
 		</div>
@@ -359,34 +466,34 @@ function printStep2 () {
 function printStep3 () {
 ?>
 	<?php $s3 = checkStep3 (); if ($s3['all'] == 'ok') { ?>
-	<p class="alert alert-success"><span class="alert-head">Ok !</span> La configuration de la base de données a été enregistrée.</p>
+	<p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('bdd_conf_is_ok'); ?></p>
 	<?php } ?>
 
 	<form action="index.php?step=3" method="post">
-		<legend>Configuration de la base de données</legend>
+		<legend><?php echo _t ('bdd_configuration'); ?></legend>
 		<div class="form-group">
-			<label class="group-name" for="host">Host</label>
+			<label class="group-name" for="host"><?php echo _t ('host'); ?></label>
 			<div class="group-controls">
 				<input type="text" id="host" name="host" value="<?php echo isset ($_SESSION['bd_host']) ? $_SESSION['bd_host'] : 'localhost'; ?>" />
 			</div>
 		</div>
 
 		<div class="form-group">
-			<label class="group-name" for="user">Username</label>
+			<label class="group-name" for="user"><?php echo _t ('username'); ?></label>
 			<div class="group-controls">
 				<input type="text" id="user" name="user" value="<?php echo isset ($_SESSION['bd_user']) ? $_SESSION['bd_user'] : ''; ?>" />
 			</div>
 		</div>
 
 		<div class="form-group">
-			<label class="group-name" for="pass">Password</label>
+			<label class="group-name" for="pass"><?php echo _t ('password'); ?></label>
 			<div class="group-controls">
 				<input type="password" id="pass" name="pass" value="<?php echo isset ($_SESSION['bd_pass']) ? $_SESSION['bd_pass'] : ''; ?>" />
 			</div>
 		</div>
 
 		<div class="form-group">
-			<label class="group-name" for="base">Base de données</label>
+			<label class="group-name" for="base"><?php echo _t ('bdd'); ?></label>
 			<div class="group-controls">
 				<input type="text" id="base" name="base" value="<?php echo isset ($_SESSION['bd_name']) ? $_SESSION['bd_name'] : ''; ?>" />
 			</div>
@@ -394,10 +501,10 @@ function printStep3 () {
 
 		<div class="form-group form-actions">
 			<div class="group-controls">
-				<button type="submit" class="btn btn-important">Valider</button>
-				<button type="reset" class="btn">Annuler</button>
+				<button type="submit" class="btn btn-important"><?php echo _t ('save'); ?></button>
+				<button type="reset" class="btn"><?php echo _t ('cancel'); ?></button>
 				<?php if ($s3['all'] == 'ok') { ?>
-				<a class="btn btn-important next-step" href="?step=4">Passer à l'étape suivante</a>
+				<a class="btn btn-important next-step" href="?step=4"><?php echo _t ('next_step'); ?></a>
 				<?php } ?>
 			</div>
 		</div>
@@ -407,23 +514,27 @@ function printStep3 () {
 
 function printStep4 () {
 ?>
-	<p class="alert alert-success"><span class="alert-head">Félicitations !</span> L'installation s'est bien passée. Il faut maintenant supprimer le fichier <em>install.php</em> pour pouvoir accéder à FreshRSS... ou simplement cliquer sur le bouton ci-dessous ;)</p>
-	<a class="btn btn-important next-step" href="?step=5">Terminer l'installation</a>
+	<p class="alert alert-success"><span class="alert-head"><?php echo _t ('congratulations'); ?></span> <?php echo _t ('installation_is_ok'); ?></p>
+	<a class="btn btn-important next-step" href="?step=5"><?php echo _t ('finish_installation'); ?></a>
 <?php
 }
 
 function printStep5 () {
 ?>
-	<p class="alert alert-error"><span class="alert-head">Oups !</span> Quelque chose s'est mal passé, vous devriez supprimer le fichier <?php echo PUBLIC_PATH . '/install.php' ?> à la main.</p>
+	<p class="alert alert-error"><span class="alert-head"><?php echo _t ('oops'); ?></span> <?php echo _t ('install_not_deleted', PUBLIC_PATH . '/install.php'); ?></p>
 <?php
 }
 
+initTranslate ();
 
 checkStep ();
 
 switch (STEP) {
-case 1:
+case 0:
 default:
+	saveLanguage ();
+	break;
+case 1:
 	break;
 case 2:
 	saveStep2 ();
@@ -443,7 +554,7 @@ case 5:
 	<head>
 		<meta charset="utf-8">
 		<meta name="viewport" content="initial-scale=1.0">
-		<title>Installation - FreshRSS</title>
+		<title><?php echo _t ('freshrss_installation'); ?></title>
 		<link rel="stylesheet" type="text/css" media="all" href="theme/global.css" />
 		<link rel="stylesheet" type="text/css" media="all" href="theme/freshrss.css" />
 	</head>
@@ -451,25 +562,29 @@ case 5:
 
 <div class="header">
 	<div class="item title">
-		<h1><a href="index.php">FreshRSS</a></h1>
-		<h2>Installation - étape <?php echo STEP; ?></h2>
+		<h1><a href="index.php"><?php echo _t ('freshrss'); ?></a></h1>
+		<h2><?php echo _t ('installation_step', STEP); ?></h2>
 	</div>
 </div>
 
 <div id="global">
 	<ul class="nav nav-list aside">
-		<li class="nav-header">Étapes</li>
-		<li class="item<?php echo STEP == 1 ? ' active' : ''; ?>"><a href="?step=1">Vérifications</a></li>
-		<li class="item<?php echo STEP == 2 ? ' active' : ''; ?>"><a href="?step=2">Configuration générale</a></li>
-		<li class="item<?php echo STEP == 3 ? ' active' : ''; ?>"><a href="?step=3">Configuration de la base de données</a></li>
-		<li class="item<?php echo STEP == 4 ? ' active' : ''; ?>"><a href="?step=4">This is the end</a></li>
+		<li class="nav-header"><?php echo _t ('steps'); ?></li>
+		<li class="item<?php echo STEP == 0 ? ' active' : ''; ?>"><a href="?step=0"><?php echo _t ('language'); ?></a></li>
+		<li class="item<?php echo STEP == 1 ? ' active' : ''; ?>"><a href="?step=1"><?php echo _t ('checks'); ?></a></li>
+		<li class="item<?php echo STEP == 2 ? ' active' : ''; ?>"><a href="?step=2"><?php echo _t ('general_configuration'); ?></a></li>
+		<li class="item<?php echo STEP == 3 ? ' active' : ''; ?>"><a href="?step=3"><?php echo _t ('bdd_configuration'); ?></a></li>
+		<li class="item<?php echo STEP == 4 ? ' active' : ''; ?>"><a href="?step=4"><?php echo _t ('this_is_the_end'); ?></a></li>
 	</ul>
 
 	<div class="post">
 		<?php
 		switch (STEP) {
-		case 1:
+		case 0:
 		default:
+			printStep0 ();
+			break;
+		case 1:
 			printStep1 ();
 			break;
 		case 2: