Compare commits

..

No commits in common. "4b5986362efc292d1cc80bff3a63beb7ad560bb6" and "ffb0e644394710beda62dce9559a101c39aaa5aa" have entirely different histories.

14 changed files with 397 additions and 605 deletions

View file

@ -3,10 +3,9 @@
use EesyPHP\Check; use EesyPHP\Check;
use EesyPHP\Cli; use EesyPHP\Cli;
use EesyPHP\Date; use EesyPHP\Date;
use EesyPHP\I18n;
use EesyPHP\Log; use EesyPHP\Log;
use function EesyPHP\___;
/* /*
************************************************************************************************* *************************************************************************************************
* /!\ Code after this message will only be execute on CLI context /!\ * /!\ Code after this message will only be execute on CLI context /!\
@ -114,13 +113,13 @@ function cli_list($command_args) {
Cli :: add_command( Cli :: add_command(
'list', 'list',
'cli_list', 'cli_list',
___("List/search items"), I18n :: ___("List/search items"),
___("[patterns]"), I18n :: ___("[patterns]"),
array( array(
___("-o|--orderby Ordering list criterion. Possible values:"), I18n :: ___("-o|--orderby Ordering list criterion. Possible values:"),
" - ".implode("\n - ", $orderbys), " - ".implode("\n - ", $orderbys),
___("-r|--reverse Reverse order"), I18n :: ___("-r|--reverse Reverse order"),
___("-s|--status Filter on status. Possible values:"), I18n :: ___("-s|--status Filter on status. Possible values:"),
" - ".implode("\n - ", array_keys($status_list)), " - ".implode("\n - ", array_keys($status_list)),
) )
); );
@ -141,8 +140,8 @@ function cli_show($command_args) {
Cli :: add_command( Cli :: add_command(
'show', 'show',
'cli_show', 'cli_show',
___("Show item"), I18n :: ___("Show item"),
___("[ID]") I18n :: ___("[ID]")
); );
function cli_delete($command_args) { function cli_delete($command_args) {
@ -179,8 +178,8 @@ function cli_delete($command_args) {
Cli :: add_command( Cli :: add_command(
'delete', 'delete',
'cli_delete', 'cli_delete',
___("Delete item"), I18n :: ___("Delete item"),
___("[item ID]") I18n :: ___("[item ID]")
); );
function cli_export($command_args) { function cli_export($command_args) {
@ -192,8 +191,8 @@ function cli_export($command_args) {
Cli :: add_command( Cli :: add_command(
'export', 'export',
'cli_export', 'cli_export',
___("Export items (as CSV)"), I18n :: ___("Export items (as CSV)"),
___("[output file path]") I18n :: ___("[output file path]")
); );
function cli_restore($command_args) { function cli_restore($command_args) {
@ -208,8 +207,8 @@ function cli_restore($command_args) {
Cli :: add_command( Cli :: add_command(
'restore', 'restore',
'cli_restore', 'cli_restore',
___("Restore items (from CSV)"), I18n :: ___("Restore items (from CSV)"),
___("[input file path]") I18n :: ___("[input file path]")
); );
function cli_cron($command_args) { function cli_cron($command_args) {
@ -276,11 +275,11 @@ function cli_cron($command_args) {
Cli :: add_command( Cli :: add_command(
'cron', 'cron',
'cli_cron', 'cli_cron',
___("Cron to handle item expiration"), I18n :: ___("Cron to handle item expiration"),
null, null,
array ( array (
___("-j/--just-try Just-try mode : do not really removed expired item(s)"), I18n :: ___("-j/--just-try Just-try mode : do not really removed expired item(s)"),
___("-m/--max-age Item expiration limit (in days, optional)"), I18n :: ___("-m/--max-age Item expiration limit (in days, optional)"),
) )
); );

View file

@ -1,10 +1,9 @@
<?php <?php
use EesyPHP\App; use EesyPHP\App;
use EesyPHP\I18n;
use EesyPHP\SentrySpan; use EesyPHP\SentrySpan;
use function EesyPHP\___;
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED); error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
// Root directory path // Root directory path
@ -55,10 +54,10 @@ require_once('functions.php');
// Nomenclatures // Nomenclatures
$status_list = array ( $status_list = array (
'pending' => ___('Pending'), 'pending' => I18n :: ___('Pending'),
'validated' => ___('Validated'), 'validated' => I18n :: ___('Validated'),
'refused' => ___('Refused'), 'refused' => I18n :: ___('Refused'),
'archived' => ___('Archived'), 'archived' => I18n :: ___('Archived'),
); );
foreach($status_list as $key => $value) foreach($status_list as $key => $value)
$status_list[$key] = _($value); $status_list[$key] = _($value);

File diff suppressed because one or more lines are too long

View file

@ -1,9 +1,9 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"POT-Creation-Date: 2023-03-22 18:21+0100\n" "POT-Creation-Date: 2023-03-11 11:52+0100\n"
"PO-Revision-Date: \n" "PO-Revision-Date: \n"
"Last-Translator: Benjamin Renard <brenard@easter-eggs.com>\n" "Last-Translator: Benjamin Renard <brenard@zionetrix.net>\n"
"Language-Team: \n" "Language-Team: \n"
"Language: fr_FR\n" "Language: fr_FR\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -12,108 +12,6 @@ msgstr ""
"X-Generator: Poedit 2.4.2\n" "X-Generator: Poedit 2.4.2\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: Tpl.php:437
msgid "No template specified."
msgstr "Aucun template spécifié."
#: Tpl.php:471
msgid "An error occurred while displaying this page."
msgstr "Une erreur est survenue en affichant cette page."
#: Tpl.php:871
msgid "Unkwown"
msgstr "Inconnu"
#: Db.php:80
msgid "Unable to connect to the database."
msgstr "Impossible de se connecter à la base de données."
#: Auth/Form.php:41
msgid "Invalid username or password."
msgstr "Nom d'utilisateur ou mot de passe invalide."
#: Auth/Form.php:74
msgid "Sign in"
msgstr "Connexion"
#: Auth/Http.php:37 Url.php:181
msgid "Authentication required"
msgstr "Authentification requise"
#: Auth/Http.php:124 Auth/Http.php:127 Url.php:185
msgid "Access denied"
msgstr "Accès interdit"
#: Auth/Http.php:128 Auth/Http.php:132
msgid "You must login to access this page."
msgstr "Vous devez vous connecter pour accéder à cette page."
#: Url.php:177
msgid "Bad request"
msgstr "Mauvaise requête"
#: Url.php:178
msgid "Invalid request."
msgstr "Requête invalide."
#: Url.php:182
msgid "You have to be authenticated to access to this page."
msgstr "Vous devez être authentifié pour accéder à cette page."
#: Url.php:186
msgid ""
"You do not have access to this application. If you think this is an error, "
"please contact support."
msgstr ""
"Vous n'avez pas accès à cette application. Si vous pensez qu'il s'agit d'une "
"erreur, merci de prendre contact avec le support."
#: Url.php:189
msgid "Whoops ! Page not found"
msgstr "Oups ! Page introuvable"
#: Url.php:190
msgid "The requested page can not be found."
msgstr "La page demandée est introuvable."
#: Url.php:198
msgid "Error"
msgstr "Erreur"
#: Url.php:199
msgid "An unknown error occurred. If problem persist, please contact support."
msgstr ""
"Une erreur inconnue est survenue. Si le problème persiste, merci de prendre "
"contact avec le support."
#: Url.php:262
msgid ""
"Unable to determine the requested page. If the problem persists, please "
"contact support."
msgstr ""
"Impossible de déterminer la page demandée. Si le problème persiste, merci de "
"prendre contact avec le support."
#: Url.php:416
msgid ""
"Unable to determine the requested page (loop detected). If the problem "
"persists, please contact support."
msgstr ""
"Impossible de déterminer la page demandée (boucle détectée). Si le problème "
"persiste, merci de prendre contact avec le support."
#: Url.php:446
msgid "This request cannot be processed."
msgstr "Cette requête ne peut être traitée."
#: Url.php:456
msgid "Authentication required but fail to authenticate you."
msgstr "Authentification requise mais impossible pour vous authentifier."
#: Url.php:475
msgid "This request could not be processed correctly."
msgstr "Cette requête n'a put être traitée correctement."
#: Cli.php:44 #: Cli.php:44
msgid "Create a new project using EesyPHP framework" msgid "Create a new project using EesyPHP framework"
msgstr "Créer un nouveau projet utilisant le framework EesyPHP" msgstr "Créer un nouveau projet utilisant le framework EesyPHP"
@ -240,51 +138,140 @@ msgstr ""
msgid "Please enter password:" msgid "Please enter password:"
msgstr "Merci de saisir le mot de passe :" msgstr "Merci de saisir le mot de passe :"
#: functions.php:304 #: Db.php:74
msgid "d" msgid "Unable to connect to the database."
msgstr "j" msgstr "Impossible de se connecter à la base de données."
#: functions.php:305 #: Auth/Form.php:41
msgid "h" msgid "Invalid username or password."
msgstr "h" msgstr "Nom d'utilisateur ou mot de passe invalide."
#: functions.php:306 #: Auth/Form.php:74
msgid "m" msgid "Sign in"
msgstr "m" msgstr "Connexion"
#: functions.php:307 #: Auth/Http.php:37 Url.php:181
msgid "s" msgid "Authentication required"
msgstr "s" msgstr "Authentification requise"
#: functions.php:308 #: Auth/Http.php:124 Auth/Http.php:127 Url.php:185
msgid "ms" msgid "Access denied"
msgstr "ms" msgstr "Accès interdit"
#: functions.php:309 #: Auth/Http.php:128 Auth/Http.php:132
msgid "ns" msgid "You must login to access this page."
msgstr "ns" msgstr "Vous devez vous connecter pour accéder à cette page."
#: functions.php:327 #: Email.php:101
#, php-format #, php-format
msgid "Less than 1%s" msgid "</hr><p><small>Mail initialy intended for %s.</small></p>"
msgstr "Moins de 1%s" msgstr "</hr><p><small>Email initialement destiné à %s.</small></p>"
#: App.php:241 I18n.php:118 #: Email.php:102
#, php-format
msgid ""
"\n"
"\n"
"\n"
"Mail initialy intended for %s."
msgstr ""
"\n"
"\n"
"\n"
"Mail originalement destiné à %s."
#: Email.php:139
#, php-format
msgid "<p><small>%s: %s</small></p>"
msgstr "<p><small>%s: %s</small></p>"
#: Email.php:140
#, php-format
msgid ""
"\n"
"%s: %s"
msgstr ""
"\n"
"%s: %s"
#: Tpl.php:421
msgid "No template specified."
msgstr "Aucun template spécifié."
#: Tpl.php:454
msgid "An error occurred while displaying this page."
msgstr "Une erreur est survenue en affichant cette page."
#: Url.php:177
msgid "Bad request"
msgstr "Mauvaise requête"
#: Url.php:178
msgid "Invalid request."
msgstr "Requête invalide."
#: Url.php:182
msgid "You have to be authenticated to access to this page."
msgstr "Vous devez être authentifié pour accéder à cette page."
#: Url.php:186
msgid ""
"You do not have access to this application. If you think this is an error, "
"please contact support."
msgstr ""
"Vous n'avez pas accès à cette application. Si vous pensez qu'il s'agit d'une "
"erreur, merci de prendre contact avec le support."
#: Url.php:189
msgid "Whoops ! Page not found"
msgstr "Oups ! Page introuvable"
#: Url.php:190
msgid "The requested page can not be found."
msgstr "La page demandée est introuvable."
#: Url.php:198
msgid "Error"
msgstr "Erreur"
#: Url.php:199
msgid "An unknown error occurred. If problem persist, please contact support."
msgstr ""
"Une erreur inconnue est survenue. Si le problème persiste, merci de prendre "
"contact avec le support."
#: Url.php:262
msgid ""
"Unable to determine the requested page. If the problem persists, please "
"contact support."
msgstr ""
"Impossible de déterminer la page demandée. Si le problème persiste, merci de "
"prendre contact avec le support."
#: Url.php:416
msgid ""
"Unable to determine the requested page (loop detected). If the problem "
"persists, please contact support."
msgstr ""
"Impossible de déterminer la page demandée (boucle détectée). Si le problème "
"persiste, merci de prendre contact avec le support."
#: Url.php:446
msgid "This request cannot be processed."
msgstr "Cette requête ne peut être traitée."
#: Url.php:456
msgid "Authentication required but fail to authenticate you."
msgstr "Authentification requise mais impossible pour vous authentifier."
#: Url.php:475
msgid "This request could not be processed correctly."
msgstr "Cette requête n'a put être traitée correctement."
#: I18n.php:118 App.php:238
msgid "Hello world !" msgid "Hello world !"
msgstr "Bonjour tout le monde !" msgstr "Bonjour tout le monde !"
#: App.php:243
msgid "Hello world!"
msgstr "Salut tout le monde !"
#: App.php:254
msgid "Disconnected"
msgstr "Déconnecté"
#: App.php:256
msgid "You are now disconnected."
msgstr "Vous êtes maintenant déconnecté."
#: I18n.php:138 #: I18n.php:138
msgid "Extract messages that need to be translated" msgid "Extract messages that need to be translated"
msgstr "Extraire les messages devant être traduit" msgstr "Extraire les messages devant être traduit"
@ -325,34 +312,34 @@ msgstr ""
"Cette commande peut-être utilisée pour compiler les fichiers PO dans les " "Cette commande peut-être utilisée pour compiler les fichiers PO dans les "
"dossiers locales/*/LC_MESSAGES and les catalogues JS dans le dossier locales." "dossiers locales/*/LC_MESSAGES and les catalogues JS dans le dossier locales."
#: I18n.php:347 #: I18n.php:356
msgid "Fail to list EesyPHP PHP files." msgid "Fail to list EesyPHP PHP files."
msgstr "Une erreur est survenue en listant les fichiers PHP d'EesyPHP." msgstr "Une erreur est survenue en listant les fichiers PHP d'EesyPHP."
#: I18n.php:367 #: I18n.php:376
msgid "Fail to extract messages from EesyPHP PHP files using xgettext." msgid "Fail to extract messages from EesyPHP PHP files using xgettext."
msgstr "" msgstr ""
"Une erreur est survenue en extrayant les messages depuis les fichiers PHP " "Une erreur est survenue en extrayant les messages depuis les fichiers PHP "
"d'EesyPHP en utilisant xgettext." "d'EesyPHP en utilisant xgettext."
#: I18n.php:384 #: I18n.php:393
msgid "Fail to list application PHP files." msgid "Fail to list application PHP files."
msgstr "Une erreur est survenue en listant les fichiers PHP de l'application." msgstr "Une erreur est survenue en listant les fichiers PHP de l'application."
#: I18n.php:404 #: I18n.php:413
msgid "Fail to extract messages from PHP files using xgettext." msgid "Fail to extract messages from PHP files using xgettext."
msgstr "" msgstr ""
"Impossible d'extraire les messages depuis les fichiers PHP en utilisant " "Impossible d'extraire les messages depuis les fichiers PHP en utilisant "
"xgettext." "xgettext."
#: I18n.php:420 #: I18n.php:429
#, php-format #, php-format
msgid "Fail to list JS files in the directory of static files '%s'." msgid "Fail to list JS files in the directory of static files '%s'."
msgstr "" msgstr ""
"Une erreur est survenue en listant les fichiers JS dans le dossier des " "Une erreur est survenue en listant les fichiers JS dans le dossier des "
"fichiers statiques '%s'." "fichiers statiques '%s'."
#: I18n.php:442 #: I18n.php:451
#, php-format #, php-format
msgid "" msgid ""
"Fail to extract messages from JS files in the directory of static files '%s' " "Fail to extract messages from JS files in the directory of static files '%s' "
@ -361,7 +348,7 @@ msgstr ""
"Une erreur est survenue en extrayant les messages depuis les fichiers JS du " "Une erreur est survenue en extrayant les messages depuis les fichiers JS du "
"dossier des fichiers statiques '%s' en utilisant xgettext." "dossier des fichiers statiques '%s' en utilisant xgettext."
#: I18n.php:464 #: I18n.php:473
#, php-format #, php-format
msgid "" msgid ""
"Fail to extract messages from templates directory '%s' using tsmarty2c.php " "Fail to extract messages from templates directory '%s' using tsmarty2c.php "
@ -370,100 +357,100 @@ msgstr ""
"Impossible d'extraire les messages depuis le dossier de templates '%s' en " "Impossible d'extraire les messages depuis le dossier de templates '%s' en "
"utilisant le script tsmarty2c.php." "utilisant le script tsmarty2c.php."
#: I18n.php:500 #: I18n.php:509
msgid "Fail to merge messages using msgcat." msgid "Fail to merge messages using msgcat."
msgstr "Impossible de fusionner les messages en utilisant msgcat." msgstr "Impossible de fusionner les messages en utilisant msgcat."
#: I18n.php:514 #: I18n.php:523
#, php-format #, php-format
msgid "Compendium file %s not found." msgid "Compendium file %s not found."
msgstr "Fichier compendium %s introuvable." msgstr "Fichier compendium %s introuvable."
#: I18n.php:525 #: I18n.php:534
#, php-format #, php-format
msgid "POT file not found (%s). Please run extract_messages first." msgid "POT file not found (%s). Please run extract_messages first."
msgstr "" msgstr ""
"Fichier POT introuvable (%s). Merci de lancer la commande extract_messages " "Fichier POT introuvable (%s). Merci de lancer la commande extract_messages "
"pour commencer." "pour commencer."
#: I18n.php:537 I18n.php:647 #: I18n.php:546 I18n.php:656
#, php-format #, php-format
msgid "Lang directory '%s' found" msgid "Lang directory '%s' found"
msgstr "Dossier de langue '%s' trouvé" msgstr "Dossier de langue '%s' trouvé"
#: I18n.php:543 I18n.php:653 #: I18n.php:552 I18n.php:662
#, php-format #, php-format
msgid "LC_MESSAGES directory not found in lang '%s' directory, ignore it." msgid "LC_MESSAGES directory not found in lang '%s' directory, ignore it."
msgstr "" msgstr ""
"Le dossier LC_MESSAGES est introuvable dans le dossier de langue '%s', on " "Le dossier LC_MESSAGES est introuvable dans le dossier de langue '%s', on "
"l'ignore." "l'ignore."
#: I18n.php:558 #: I18n.php:567
#, php-format #, php-format
msgid "Fail to init messages in %s PO file using msginit (%s)." msgid "Fail to init messages in %s PO file using msginit (%s)."
msgstr "" msgstr ""
"Impossible d'initialiser les messages dans le fichier PO %s en utilisant " "Impossible d'initialiser les messages dans le fichier PO %s en utilisant "
"msginit (%s)." "msginit (%s)."
#: I18n.php:576 #: I18n.php:585
#, php-format #, php-format
msgid "Fail to update messages in %s PO file using msgmerge (%s)." msgid "Fail to update messages in %s PO file using msgmerge (%s)."
msgstr "" msgstr ""
"Impossible de mettre à jour les messages dans les fichiers PO %s en " "Impossible de mettre à jour les messages dans les fichiers PO %s en "
"utilisant msgmerge (%s)." "utilisant msgmerge (%s)."
#: I18n.php:582 I18n.php:661 #: I18n.php:591 I18n.php:670
#, php-format #, php-format
msgid "PO file not found in lang '%s' directory, ignore it." msgid "PO file not found in lang '%s' directory, ignore it."
msgstr "" msgstr ""
"Le fichier PO est introuvable dans le dossier de langue '%s', on l'ignore." "Le fichier PO est introuvable dans le dossier de langue '%s', on l'ignore."
#: I18n.php:589 I18n.php:716 #: I18n.php:598 I18n.php:725
#, php-format #, php-format
msgid "Fail to open root lang directory (%s)." msgid "Fail to open root lang directory (%s)."
msgstr "Impossible d'ouvrir le dossier racine des langues (%s)." msgstr "Impossible d'ouvrir le dossier racine des langues (%s)."
#: I18n.php:617 #: I18n.php:626
#, php-format #, php-format
msgid "Lang alias symlink found: %s -> %s" msgid "Lang alias symlink found: %s -> %s"
msgstr "Lien symbolique d'alias de langue trouvé : %s -> %s" msgstr "Lien symbolique d'alias de langue trouvé : %s -> %s"
#: I18n.php:624 #: I18n.php:633
#, php-format #, php-format
msgid "JS catalog symlink for %s -> %s created (%s)" msgid "JS catalog symlink for %s -> %s created (%s)"
msgstr "Lien symbolique de catalogue JS pour %s -> %s créé (%s)" msgstr "Lien symbolique de catalogue JS pour %s -> %s créé (%s)"
#: I18n.php:628 #: I18n.php:637
#, php-format #, php-format
msgid "Fail to create JS catalog symlink for %s -> %s (%s)" msgid "Fail to create JS catalog symlink for %s -> %s (%s)"
msgstr "" msgstr ""
"Impossible de créer le lien symbolique de catalogue JS pour %s -> %s (%s)" "Impossible de créer le lien symbolique de catalogue JS pour %s -> %s (%s)"
#: I18n.php:634 #: I18n.php:643
#, php-format #, php-format
msgid "JS catalog symlink for %s -> %s already exist (%s)" msgid "JS catalog symlink for %s -> %s already exist (%s)"
msgstr "Le lien symbolique du catalogue JS pour %s -> %s existe déjà (%s)" msgstr "Le lien symbolique du catalogue JS pour %s -> %s existe déjà (%s)"
#: I18n.php:639 #: I18n.php:648
#, php-format #, php-format
msgid "JS catalog file for %s already exist, but it's not a symlink to %s (%s)" msgid "JS catalog file for %s already exist, but it's not a symlink to %s (%s)"
msgstr "" msgstr ""
"Le catalogue JS pour %s existe, mais il ne s'agit par d'un lien symbolique " "Le catalogue JS pour %s existe, mais il ne s'agit par d'un lien symbolique "
"vers %s (%s)" "vers %s (%s)"
#: I18n.php:674 #: I18n.php:683
#, php-format #, php-format
msgid "Fail to compile messages from %s PO file as MO file using msgfmt (%s)." msgid "Fail to compile messages from %s PO file as MO file using msgfmt (%s)."
msgstr "" msgstr ""
"Impossible de compiler les messages depuis le fichier PO %s en tant que " "Impossible de compiler les messages depuis le fichier PO %s en tant que "
"fichier MO en utilisant msgfmt (%s)." "fichier MO en utilisant msgfmt (%s)."
#: I18n.php:686 #: I18n.php:695
#, php-format #, php-format
msgid "Include core translated messages from %s PO file" msgid "Include core translated messages from %s PO file"
msgstr "Inclusion des messages traduits (core) depuis le fichier PO %s" msgstr "Inclusion des messages traduits (core) depuis le fichier PO %s"
#: I18n.php:693 #: I18n.php:702
#, php-format #, php-format
msgid "" msgid ""
"Core PO file %s not found: can not include its translated messages in " "Core PO file %s not found: can not include its translated messages in "
@ -472,52 +459,32 @@ msgstr ""
"Le fichier PO core %s est introuvable : impossible d'inclure ses messages " "Le fichier PO core %s est introuvable : impossible d'inclure ses messages "
"traduits dans le catalogue JSON résultant." "traduits dans le catalogue JSON résultant."
#: I18n.php:699 #: I18n.php:708
#, php-format #, php-format
msgid "Fail to open %s JS catalog file in write mode (%s)." msgid "Fail to open %s JS catalog file in write mode (%s)."
msgstr "Impossible d'ouvrir le catalogue JS %s en mode écriture (%s)." msgstr "Impossible d'ouvrir le catalogue JS %s en mode écriture (%s)."
#: I18n.php:704 #: I18n.php:713
#, php-format #, php-format
msgid "Fail to write %s JS catalog in file (%s)." msgid "Fail to write %s JS catalog in file (%s)."
msgstr "Impossible d'écrire le fichier du catalogue JS %s (%s)." msgstr "Impossible d'écrire le fichier du catalogue JS %s (%s)."
#: I18n.php:709 #: I18n.php:718
#, php-format #, php-format
msgid "%s JS catalog writed (%s)." msgid "%s JS catalog writed (%s)."
msgstr "Catalogue JS %s créé (%s)." msgstr "Catalogue JS %s créé (%s)."
#: Email.php:101 #: App.php:240
#, php-format msgid "Hello world!"
msgid "</hr><p><small>Mail initialy intended for %s.</small></p>" msgstr "Salut tout le monde !"
msgstr "</hr><p><small>Email initialement destiné à %s.</small></p>"
#: Email.php:102 #: App.php:251
#, php-format msgid "Disconnected"
msgid "" msgstr "Déconnecté"
"\n"
"\n"
"\n"
"Mail initialy intended for %s."
msgstr ""
"\n"
"\n"
"\n"
"Mail originalement destiné à %s."
#: Email.php:139 #: App.php:253
#, php-format msgid "You are now disconnected."
msgid "<p><small>%s: %s</small></p>" msgstr "Vous êtes maintenant déconnecté."
msgstr "<p><small>%s: %s</small></p>"
#: Email.php:140
#, php-format
msgid ""
"\n"
"%s: %s"
msgstr ""
"\n"
"%s: %s"
#: static/js/myconfirm.js:4 static/js/myconfirm.js:187 #: static/js/myconfirm.js:4 static/js/myconfirm.js:187
#: static/js/myconfirm.js:216 #: static/js/myconfirm.js:216
@ -560,23 +527,11 @@ msgstr "Merci de patienter pendant le traitement de votre requête."
msgid "Are you sure?" msgid "Are you sure?"
msgstr "Êtes-vous sure ?" msgstr "Êtes-vous sure ?"
#: templates/login.tpl:19 templates/login.tpl:20 #: templates/fatal_error.tpl:3
msgid "Username"
msgstr "Nom d'utilisateur"
#: templates/login.tpl:24 templates/login.tpl:25
msgid "Password"
msgstr "Mot de passe"
#: templates/login.tpl:29
msgid "Submit"
msgstr "Envoyer"
#: templates/fatal_error.tpl:7
msgid "Oops..." msgid "Oops..."
msgstr "Oups..." msgstr "Oups..."
#: templates/fatal_error.tpl:10 #: templates/fatal_error.tpl:5
msgid "" msgid ""
"A fatal error has occurred and it is preventing this application from " "A fatal error has occurred and it is preventing this application from "
"working properly. Please try again later or contact support." "working properly. Please try again later or contact support."
@ -585,42 +540,14 @@ msgstr ""
"fonctionner correctement. Merci de réessayer ultérieurement ou de prendre " "fonctionner correctement. Merci de réessayer ultérieurement ou de prendre "
"contact avec le service support." "contact avec le service support."
#: templates/fatal_error.tpl:13 #: templates/fatal_error.tpl:7
msgid "Error: %1" msgid "Error: %1"
msgstr "Erreur : %1" msgstr "Erreur : %1"
#: templates/fatal_error.tpl:17 #: templates/fatal_error.tpl:9
msgid "Back" msgid "Back"
msgstr "Retour" msgstr "Retour"
#: templates/empty.tpl:72
msgid "Sign out"
msgstr "Déconnexion"
#: templates/empty.tpl:82
msgid "Log in"
msgstr "Connexion"
#: templates/empty.tpl:117
msgid "Loading time:"
msgstr "Temps de chargement :"
#: templates/empty.tpl:118
msgid "Page: %1"
msgstr "Page : %1"
#: templates/empty.tpl:119
msgid "Database: %1"
msgstr "Base de données : %1"
#: templates/empty.tpl:120
msgid "Templating: "
msgstr "Modèle : "
#: templates/empty.tpl:121
msgid "Total: "
msgstr "Total : "
#: templates/homepage.tpl:6 #: templates/homepage.tpl:6
msgid "Hello, world!" msgid "Hello, world!"
msgstr "Bonjour tout le monde !" msgstr "Bonjour tout le monde !"
@ -637,6 +564,26 @@ msgstr ""
"fichier <em>homepage.tpl</em> pour l'écraser. Vous pouvez également écraser " "fichier <em>homepage.tpl</em> pour l'écraser. Vous pouvez également écraser "
"le gestionnaire de l'URL racine de l'application web." "le gestionnaire de l'URL racine de l'application web."
#: templates/empty.tpl:72
msgid "Sign out"
msgstr "Déconnexion"
#: templates/empty.tpl:81
msgid "Log in"
msgstr "Connexion"
#: templates/login.tpl:19 templates/login.tpl:20
msgid "Username"
msgstr "Nom d'utilisateur"
#: templates/login.tpl:24 templates/login.tpl:25
msgid "Password"
msgstr "Mot de passe"
#: templates/login.tpl:29
msgid "Submit"
msgstr "Envoyer"
#~ msgid "Logout" #~ msgid "Logout"
#~ msgstr "Déconnexion" #~ msgstr "Déconnexion"

View file

@ -1,105 +1,11 @@
msgid "" msgid ""
msgstr "" msgstr ""
"POT-Creation-Date: 2023-03-22 18:21+0100\n" "POT-Creation-Date: 2023-03-11 11:52+0100\n"
"PO-Revision-Date: 2023-03-22 18:21+0100\n" "PO-Revision-Date: 2023-03-11 11:52+0100\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: Tpl.php:437
msgid "No template specified."
msgstr ""
#: Tpl.php:471
msgid "An error occurred while displaying this page."
msgstr ""
#: Tpl.php:871
msgid "Unkwown"
msgstr ""
#: Db.php:80
msgid "Unable to connect to the database."
msgstr ""
#: Auth/Form.php:41
msgid "Invalid username or password."
msgstr ""
#: Auth/Form.php:74
msgid "Sign in"
msgstr ""
#: Auth/Http.php:37 Url.php:181
msgid "Authentication required"
msgstr ""
#: Auth/Http.php:124 Auth/Http.php:127 Url.php:185
msgid "Access denied"
msgstr ""
#: Auth/Http.php:128 Auth/Http.php:132
msgid "You must login to access this page."
msgstr ""
#: Url.php:177
msgid "Bad request"
msgstr ""
#: Url.php:178
msgid "Invalid request."
msgstr ""
#: Url.php:182
msgid "You have to be authenticated to access to this page."
msgstr ""
#: Url.php:186
msgid ""
"You do not have access to this application. If you think this is an error, "
"please contact support."
msgstr ""
#: Url.php:189
msgid "Whoops ! Page not found"
msgstr ""
#: Url.php:190
msgid "The requested page can not be found."
msgstr ""
#: Url.php:198
msgid "Error"
msgstr ""
#: Url.php:199
msgid "An unknown error occurred. If problem persist, please contact support."
msgstr ""
#: Url.php:262
msgid ""
"Unable to determine the requested page. If the problem persists, please "
"contact support."
msgstr ""
#: Url.php:416
msgid ""
"Unable to determine the requested page (loop detected). If the problem "
"persists, please contact support."
msgstr ""
#: Url.php:446
msgid "This request cannot be processed."
msgstr ""
#: Url.php:456
msgid "Authentication required but fail to authenticate you."
msgstr ""
#: Url.php:475
msgid "This request could not be processed correctly."
msgstr ""
#: Cli.php:44 #: Cli.php:44
msgid "Create a new project using EesyPHP framework" msgid "Create a new project using EesyPHP framework"
msgstr "" msgstr ""
@ -208,51 +114,126 @@ msgstr ""
msgid "Please enter password:" msgid "Please enter password:"
msgstr "" msgstr ""
#: functions.php:304 #: Db.php:74
msgid "d" msgid "Unable to connect to the database."
msgstr "" msgstr ""
#: functions.php:305 #: Auth/Form.php:41
msgid "h" msgid "Invalid username or password."
msgstr "" msgstr ""
#: functions.php:306 #: Auth/Form.php:74
msgid "m" msgid "Sign in"
msgstr "" msgstr ""
#: functions.php:307 #: Auth/Http.php:37 Url.php:181
msgid "s" msgid "Authentication required"
msgstr "" msgstr ""
#: functions.php:308 #: Auth/Http.php:124 Auth/Http.php:127 Url.php:185
msgid "ms" msgid "Access denied"
msgstr "" msgstr ""
#: functions.php:309 #: Auth/Http.php:128 Auth/Http.php:132
msgid "ns" msgid "You must login to access this page."
msgstr "" msgstr ""
#: functions.php:327 #: Email.php:101
#, php-format #, php-format
msgid "Less than 1%s" msgid "</hr><p><small>Mail initialy intended for %s.</small></p>"
msgstr "" msgstr ""
#: App.php:241 I18n.php:118 #: Email.php:102
#, php-format
msgid ""
"\n"
"\n"
"\n"
"Mail initialy intended for %s."
msgstr ""
#: Email.php:139
#, php-format
msgid "<p><small>%s: %s</small></p>"
msgstr ""
#: Email.php:140
#, php-format
msgid ""
"\n"
"%s: %s"
msgstr ""
#: Tpl.php:421
msgid "No template specified."
msgstr ""
#: Tpl.php:454
msgid "An error occurred while displaying this page."
msgstr ""
#: Url.php:177
msgid "Bad request"
msgstr ""
#: Url.php:178
msgid "Invalid request."
msgstr ""
#: Url.php:182
msgid "You have to be authenticated to access to this page."
msgstr ""
#: Url.php:186
msgid ""
"You do not have access to this application. If you think this is an error, "
"please contact support."
msgstr ""
#: Url.php:189
msgid "Whoops ! Page not found"
msgstr ""
#: Url.php:190
msgid "The requested page can not be found."
msgstr ""
#: Url.php:198
msgid "Error"
msgstr ""
#: Url.php:199
msgid "An unknown error occurred. If problem persist, please contact support."
msgstr ""
#: Url.php:262
msgid ""
"Unable to determine the requested page. If the problem persists, please "
"contact support."
msgstr ""
#: Url.php:416
msgid ""
"Unable to determine the requested page (loop detected). If the problem "
"persists, please contact support."
msgstr ""
#: Url.php:446
msgid "This request cannot be processed."
msgstr ""
#: Url.php:456
msgid "Authentication required but fail to authenticate you."
msgstr ""
#: Url.php:475
msgid "This request could not be processed correctly."
msgstr ""
#: I18n.php:118 App.php:238
msgid "Hello world !" msgid "Hello world !"
msgstr "" msgstr ""
#: App.php:243
msgid "Hello world!"
msgstr ""
#: App.php:254
msgid "Disconnected"
msgstr ""
#: App.php:256
msgid "You are now disconnected."
msgstr ""
#: I18n.php:138 #: I18n.php:138
msgid "Extract messages that need to be translated" msgid "Extract messages that need to be translated"
msgstr "" msgstr ""
@ -284,166 +265,152 @@ msgid ""
"directories to MO files and as JS catalogs in locales directory." "directories to MO files and as JS catalogs in locales directory."
msgstr "" msgstr ""
#: I18n.php:347 #: I18n.php:356
msgid "Fail to list EesyPHP PHP files." msgid "Fail to list EesyPHP PHP files."
msgstr "" msgstr ""
#: I18n.php:367 #: I18n.php:376
msgid "Fail to extract messages from EesyPHP PHP files using xgettext." msgid "Fail to extract messages from EesyPHP PHP files using xgettext."
msgstr "" msgstr ""
#: I18n.php:384 #: I18n.php:393
msgid "Fail to list application PHP files." msgid "Fail to list application PHP files."
msgstr "" msgstr ""
#: I18n.php:404 #: I18n.php:413
msgid "Fail to extract messages from PHP files using xgettext." msgid "Fail to extract messages from PHP files using xgettext."
msgstr "" msgstr ""
#: I18n.php:420 #: I18n.php:429
#, php-format #, php-format
msgid "Fail to list JS files in the directory of static files '%s'." msgid "Fail to list JS files in the directory of static files '%s'."
msgstr "" msgstr ""
#: I18n.php:442 #: I18n.php:451
#, php-format #, php-format
msgid "" msgid ""
"Fail to extract messages from JS files in the directory of static files '%s' " "Fail to extract messages from JS files in the directory of static files '%s' "
"using xgettext." "using xgettext."
msgstr "" msgstr ""
#: I18n.php:464 #: I18n.php:473
#, php-format #, php-format
msgid "" msgid ""
"Fail to extract messages from templates directory '%s' using tsmarty2c.php " "Fail to extract messages from templates directory '%s' using tsmarty2c.php "
"script." "script."
msgstr "" msgstr ""
#: I18n.php:500 #: I18n.php:509
msgid "Fail to merge messages using msgcat." msgid "Fail to merge messages using msgcat."
msgstr "" msgstr ""
#: I18n.php:514 #: I18n.php:523
#, php-format #, php-format
msgid "Compendium file %s not found." msgid "Compendium file %s not found."
msgstr "" msgstr ""
#: I18n.php:525 #: I18n.php:534
#, php-format #, php-format
msgid "POT file not found (%s). Please run extract_messages first." msgid "POT file not found (%s). Please run extract_messages first."
msgstr "" msgstr ""
#: I18n.php:537 I18n.php:647 #: I18n.php:546 I18n.php:656
#, php-format #, php-format
msgid "Lang directory '%s' found" msgid "Lang directory '%s' found"
msgstr "" msgstr ""
#: I18n.php:543 I18n.php:653 #: I18n.php:552 I18n.php:662
#, php-format #, php-format
msgid "LC_MESSAGES directory not found in lang '%s' directory, ignore it." msgid "LC_MESSAGES directory not found in lang '%s' directory, ignore it."
msgstr "" msgstr ""
#: I18n.php:558 #: I18n.php:567
#, php-format #, php-format
msgid "Fail to init messages in %s PO file using msginit (%s)." msgid "Fail to init messages in %s PO file using msginit (%s)."
msgstr "" msgstr ""
#: I18n.php:576 #: I18n.php:585
#, php-format #, php-format
msgid "Fail to update messages in %s PO file using msgmerge (%s)." msgid "Fail to update messages in %s PO file using msgmerge (%s)."
msgstr "" msgstr ""
#: I18n.php:582 I18n.php:661 #: I18n.php:591 I18n.php:670
#, php-format #, php-format
msgid "PO file not found in lang '%s' directory, ignore it." msgid "PO file not found in lang '%s' directory, ignore it."
msgstr "" msgstr ""
#: I18n.php:589 I18n.php:716 #: I18n.php:598 I18n.php:725
#, php-format #, php-format
msgid "Fail to open root lang directory (%s)." msgid "Fail to open root lang directory (%s)."
msgstr "" msgstr ""
#: I18n.php:617 #: I18n.php:626
#, php-format #, php-format
msgid "Lang alias symlink found: %s -> %s" msgid "Lang alias symlink found: %s -> %s"
msgstr "" msgstr ""
#: I18n.php:624 #: I18n.php:633
#, php-format #, php-format
msgid "JS catalog symlink for %s -> %s created (%s)" msgid "JS catalog symlink for %s -> %s created (%s)"
msgstr "" msgstr ""
#: I18n.php:628 #: I18n.php:637
#, php-format #, php-format
msgid "Fail to create JS catalog symlink for %s -> %s (%s)" msgid "Fail to create JS catalog symlink for %s -> %s (%s)"
msgstr "" msgstr ""
#: I18n.php:634 #: I18n.php:643
#, php-format #, php-format
msgid "JS catalog symlink for %s -> %s already exist (%s)" msgid "JS catalog symlink for %s -> %s already exist (%s)"
msgstr "" msgstr ""
#: I18n.php:639 #: I18n.php:648
#, php-format #, php-format
msgid "JS catalog file for %s already exist, but it's not a symlink to %s (%s)" msgid "JS catalog file for %s already exist, but it's not a symlink to %s (%s)"
msgstr "" msgstr ""
#: I18n.php:674 #: I18n.php:683
#, php-format #, php-format
msgid "Fail to compile messages from %s PO file as MO file using msgfmt (%s)." msgid "Fail to compile messages from %s PO file as MO file using msgfmt (%s)."
msgstr "" msgstr ""
#: I18n.php:686 #: I18n.php:695
#, php-format #, php-format
msgid "Include core translated messages from %s PO file" msgid "Include core translated messages from %s PO file"
msgstr "" msgstr ""
#: I18n.php:693 #: I18n.php:702
#, php-format #, php-format
msgid "" msgid ""
"Core PO file %s not found: can not include its translated messages in " "Core PO file %s not found: can not include its translated messages in "
"resulting JSON catalog." "resulting JSON catalog."
msgstr "" msgstr ""
#: I18n.php:699 #: I18n.php:708
#, php-format #, php-format
msgid "Fail to open %s JS catalog file in write mode (%s)." msgid "Fail to open %s JS catalog file in write mode (%s)."
msgstr "" msgstr ""
#: I18n.php:704 #: I18n.php:713
#, php-format #, php-format
msgid "Fail to write %s JS catalog in file (%s)." msgid "Fail to write %s JS catalog in file (%s)."
msgstr "" msgstr ""
#: I18n.php:709 #: I18n.php:718
#, php-format #, php-format
msgid "%s JS catalog writed (%s)." msgid "%s JS catalog writed (%s)."
msgstr "" msgstr ""
#: Email.php:101 #: App.php:240
#, php-format msgid "Hello world!"
msgid "</hr><p><small>Mail initialy intended for %s.</small></p>"
msgstr "" msgstr ""
#: Email.php:102 #: App.php:251
#, php-format msgid "Disconnected"
msgid ""
"\n"
"\n"
"\n"
"Mail initialy intended for %s."
msgstr "" msgstr ""
#: Email.php:139 #: App.php:253
#, php-format msgid "You are now disconnected."
msgid "<p><small>%s: %s</small></p>"
msgstr ""
#: Email.php:140
#, php-format
msgid ""
"\n"
"%s: %s"
msgstr "" msgstr ""
#: static/js/myconfirm.js:4 static/js/myconfirm.js:187 #: static/js/myconfirm.js:4 static/js/myconfirm.js:187
@ -487,64 +454,24 @@ msgstr ""
msgid "Are you sure?" msgid "Are you sure?"
msgstr "" msgstr ""
#: templates/login.tpl:19 templates/login.tpl:20 #: templates/fatal_error.tpl:3
msgid "Username"
msgstr ""
#: templates/login.tpl:24 templates/login.tpl:25
msgid "Password"
msgstr ""
#: templates/login.tpl:29
msgid "Submit"
msgstr ""
#: templates/fatal_error.tpl:7
msgid "Oops..." msgid "Oops..."
msgstr "" msgstr ""
#: templates/fatal_error.tpl:10 #: templates/fatal_error.tpl:5
msgid "" msgid ""
"A fatal error has occurred and it is preventing this application from " "A fatal error has occurred and it is preventing this application from "
"working properly. Please try again later or contact support." "working properly. Please try again later or contact support."
msgstr "" msgstr ""
#: templates/fatal_error.tpl:13 #: templates/fatal_error.tpl:7
msgid "Error: %1" msgid "Error: %1"
msgstr "" msgstr ""
#: templates/fatal_error.tpl:17 #: templates/fatal_error.tpl:9
msgid "Back" msgid "Back"
msgstr "" msgstr ""
#: templates/empty.tpl:72
msgid "Sign out"
msgstr ""
#: templates/empty.tpl:82
msgid "Log in"
msgstr ""
#: templates/empty.tpl:117
msgid "Loading time:"
msgstr ""
#: templates/empty.tpl:118
msgid "Page: %1"
msgstr ""
#: templates/empty.tpl:119
msgid "Database: %1"
msgstr ""
#: templates/empty.tpl:120
msgid "Templating: "
msgstr ""
#: templates/empty.tpl:121
msgid "Total: "
msgstr ""
#: templates/homepage.tpl:6 #: templates/homepage.tpl:6
msgid "Hello, world!" msgid "Hello, world!"
msgstr "" msgstr ""
@ -556,3 +483,23 @@ msgid ""
"it. You could also overwrite the URL handler for the root of the web " "it. You could also overwrite the URL handler for the root of the web "
"application." "application."
msgstr "" msgstr ""
#: templates/empty.tpl:72
msgid "Sign out"
msgstr ""
#: templates/empty.tpl:81
msgid "Log in"
msgstr ""
#: templates/login.tpl:19 templates/login.tpl:20
msgid "Username"
msgstr ""
#: templates/login.tpl:24 templates/login.tpl:25
msgid "Password"
msgstr ""
#: templates/login.tpl:29
msgid "Submit"
msgstr ""

View file

@ -8,9 +8,7 @@ class App {
* Options * Options
* @var array * @var array
*/ */
protected static $options = array( protected static $options = array();
'init_time' => null,
);
/** /**
* Root directory path * Root directory path
@ -26,7 +24,6 @@ class App {
* @return void * @return void
*/ */
public static function init($config_file, $options=null, $root_directory_path=null) { public static function init($config_file, $options=null, $root_directory_path=null) {
Config::register_extra_variable('init_time', hrtime(true));
if (is_array($options)) self :: $options = $options; if (is_array($options)) self :: $options = $options;
if (is_null($root_directory_path)) { if (is_null($root_directory_path)) {

View file

@ -41,9 +41,9 @@ class Cli {
self :: add_command( self :: add_command(
'new_project', 'new_project',
array('\\EesyPHP\\Cli', 'cli_new_project'), array('\\EesyPHP\\Cli', 'cli_new_project'),
___("Create a new project using EesyPHP framework"), I18n :: ___("Create a new project using EesyPHP framework"),
null, null,
___( I18n :: ___(
"This command could be used to easily build the structure of a new project using the ". "This command could be used to easily build the structure of a new project using the ".
"EesyPHP framework.") "EesyPHP framework.")
); );
@ -52,9 +52,9 @@ class Cli {
self :: add_command( self :: add_command(
'serve', 'serve',
array('\\EesyPHP\\Cli', 'cli_serve'), array('\\EesyPHP\\Cli', 'cli_serve'),
___("Start the PHP built-in HTTP server to serve the application"), I18n :: ___("Start the PHP built-in HTTP server to serve the application"),
null, null,
___( I18n :: ___(
"This command could be used to start the PHP built-in HTTP server to serve the ". "This command could be used to start the PHP built-in HTTP server to serve the ".
"application.") "application.")
); );

View file

@ -38,12 +38,6 @@ class Db {
*/ */
protected $locale_time = null; protected $locale_time = null;
/**
* Keep trace of total queries times (in ns)
* @var int;
*/
public static $total_query_time = 0;
/** /**
* Connect to database and return FluentPDO Query object * Connect to database and return FluentPDO Query object
* @param string $dsn Database DSN * @param string $dsn Database DSN
@ -71,7 +65,7 @@ class Db {
$this -> fpdo = new Query($this -> pdo); $this -> fpdo = new Query($this -> pdo);
// Register the debug query handler to log it // Register the debug query handler to log it
$this -> fpdo -> debug = array(self :: class, 'debug_query'); $this -> fpdo -> debug = array('\\EesyPHP\\Db', 'debug_query');
Log :: trace("DB connection established (DSN: '%s')", $dsn); Log :: trace("DB connection established (DSN: '%s')", $dsn);
} }
@ -87,7 +81,6 @@ class Db {
* @return void * @return void
*/ */
public static function debug_query($q) { public static function debug_query($q) {
self :: $total_query_time += intval(ceil($q->getExecutionTime() * 1000000000));
$msg = "# DB query"; $msg = "# DB query";
if ($q->getResult()) if ($q->getResult())
$msg .= sprintf( $msg .= sprintf(

View file

@ -135,28 +135,28 @@ class I18n {
Cli :: add_command( Cli :: add_command(
'extract_messages', 'extract_messages',
array('\\EesyPHP\\I18n', 'cli_extract_messages'), array('\\EesyPHP\\I18n', 'cli_extract_messages'),
___("Extract messages that need to be translated"), self :: ___("Extract messages that need to be translated"),
null, null,
___("This command could be used to generate/update locales/messages.pot file.") self :: ___("This command could be used to generate/update locales/messages.pot file.")
); );
Cli :: add_command( Cli :: add_command(
'update_messages', 'update_messages',
array('\\EesyPHP\\I18n', 'cli_update_messages'), array('\\EesyPHP\\I18n', 'cli_update_messages'),
___("Update messages in translation PO lang files"), self :: ___("Update messages in translation PO lang files"),
null, null,
___("This command could be used to init/update PO files in locales/*/LC_MESSAGES directories.") self :: ___("This command could be used to init/update PO files in locales/*/LC_MESSAGES directories.")
); );
Cli :: add_command( Cli :: add_command(
'compile_messages', 'compile_messages',
array('\\EesyPHP\\I18n', 'cli_compile_messages'), array('\\EesyPHP\\I18n', 'cli_compile_messages'),
___( self :: ___(
"Compile messages from existing translation PO lang files to ". "Compile messages from existing translation PO lang files to ".
"corresponding MO files and JS catalogs" "corresponding MO files and JS catalogs"
), ),
null, null,
___( self :: ___(
"This command could be used to compile PO files in locales/*/LC_MESSAGES ". "This command could be used to compile PO files in locales/*/LC_MESSAGES ".
"directories to MO files and as JS catalogs in locales directory." "directories to MO files and as JS catalogs in locales directory."
) )
@ -260,6 +260,15 @@ class I18n {
return $return; return $return;
} }
/**
* Just mark message for translation
* @param string $msg The message to translate
* @return string The message without transformation
*/
public static function ___($msg) {
return $msg;
}
/* /*
******************************************************************** ********************************************************************
* Translations CLI commands * * Translations CLI commands *

View file

@ -75,14 +75,6 @@ class Tpl {
*/ */
private static $mime_type_detector = null; private static $mime_type_detector = null;
/**
* Keep trace of Smarty start displaying page time
* @see display()
* @see smarty_computing_time()
* @var int
*/
private static $start_time = null;
/** /**
* Initialization * Initialization
* @return void * @return void
@ -188,10 +180,6 @@ class Tpl {
self :: register_static_directory($path); self :: register_static_directory($path);
} }
self :: register_function('var_dump', array('EesyPHP\\Tpl', 'smarty_var_dump')); self :: register_function('var_dump', array('EesyPHP\\Tpl', 'smarty_var_dump'));
self :: register_function(
'smarty_computing_time', array('EesyPHP\\Tpl', 'smarty_computing_time'));
self :: register_function(
'smarty_total_computing_time', array('EesyPHP\\Tpl', 'smarty_total_computing_time'));
self :: register_class('App', '\\EesyPHP\\App'); self :: register_class('App', '\\EesyPHP\\App');
} }
@ -419,10 +407,6 @@ class Tpl {
Tpl :: assign( Tpl :: assign(
'upload_max_filesize', 'upload_max_filesize',
App::get('upload_max_filesize', null, 'int')); App::get('upload_max_filesize', null, 'int'));
$init_time = App::get('init_time');
Tpl :: assign('compute_time', $init_time?format_duration(hrtime(true)-$init_time, 'ns', 'ms'):null);
Tpl :: assign('db_time', Db :: $total_query_time?format_duration(Db :: $total_query_time, 'ns', 'ms'):null);
} }
/** /**
@ -460,7 +444,6 @@ class Tpl {
try { try {
Hook :: trigger('before_displaying_template'); Hook :: trigger('before_displaying_template');
self :: define_common_variables($pagetitle); self :: define_common_variables($pagetitle);
self :: $start_time = hrtime(true);
self :: $smarty->display("Tpl:$template"); self :: $smarty->display("Tpl:$template");
} }
catch (Exception $e) { catch (Exception $e) {
@ -845,30 +828,4 @@ class Tpl {
if (!isset($params['data'])) return; if (!isset($params['data'])) return;
var_dump($params['data']); var_dump($params['data']);
} }
/**
* Compute Smarty computing time
* @param array<string,mixed> $params Parameters from template file
* @param Smarty $smarty The smarty object
* @return void
*/
public static function smarty_computing_time($params, $smarty) {
echo format_duration(hrtime(true) - self :: $start_time, 'ns', 'ms');
}
/**
* Compute total page computing time
* @param array<string,mixed> $params Parameters from template file
* @param Smarty $smarty The smarty object
* @return void
*/
public static function smarty_total_computing_time($params, $smarty) {
$init_time = App::get('init_time');
if ($init_time) {
echo format_duration(hrtime(true) - $init_time, 'ns', 'ms');
}
else {
echo _('Unkwown');
}
}
} }

View file

@ -282,50 +282,4 @@ function check_ajax_request($session_key=null) {
Log :: debug("Ajax Request : ".vardump($_REQUEST)); Log :: debug("Ajax Request : ".vardump($_REQUEST));
} }
/**
* Just mark message for translation
* @param string $msg The message to translate
* @return string The message without transformation
*/
function ___($msg) {
return $msg;
}
/**
* Format duration
* @param int|float $value The duration to format
* @param string|null $unit The unit of provide value (optional, default: 's')
* @param string|null $precision Minimal precision to displayed (optional, default: 's')
* @param string|null $separator The separator between time block (optional, default: null = one space)
* @return string|false The formated duration as string, or false in case of error
*/
function format_duration($value, $unit=null, $precision=null, $separator=null) {
$units = array(
___('d') => 86400000000000,
___('h') => 3600000000000,
___('m') => 60000000000,
___('s') => 1000000000,
___('ms') => 1000000,
___('ns') => 1,
);
if (!$unit) $unit = 's';
if (!array_key_exists($unit, $units)) return false;
if (!$precision) $precision = 's';
if (!array_key_exists($precision, $units)) return false;
if ($value == 0) return "0".I18n :: _($precision);
$value = $value * $units[$unit];
$result = array();
foreach ($units as $unit => $factor) {
if ($value >= $factor) {
$vunit = floor($value/$factor);
$value = $value - ($vunit * $factor);
$result[] = $vunit._($unit);
}
if ($unit == $precision) break;
}
// 0 ?
if (empty($result)) return I18n :: _('Less than 1%s', I18n :: _($precision));
return implode(is_null($separator)?' ':strval($separator), $result);
}
# vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab # vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab

View file

@ -14,12 +14,15 @@ a.navbar-brand img {
height: 27px; height: 27px;
} }
footer { #footer {
font-size: 0.9em; border-top: 1px solid #333;
margin-top: 1em;
padding-top: 1em;
} }
footer div.compute-times { #footer p {
font-size: 0.6em; font-size: 0.8em;
text-align: center;
} }
/* /*

View file

@ -110,19 +110,6 @@
<span class="text-muted"> <span class="text-muted">
<a href="https://gitea.zionetrix.net/bn8/eesyphp">EesyPHP</a> <a href="https://gitea.zionetrix.net/bn8/eesyphp">EesyPHP</a>
</span> </span>
{block name="footer-compute-times"}
{if isset($compute_time)}
<div class='compute-times'>
<span class="text-muted">
{t domain=$CORE_TEXT_DOMAIN}Loading time:{/t}
{t 1=$compute_time domain=$CORE_TEXT_DOMAIN}Page: %1{/t}
{if isset($db_time)} - {t 1=$db_time domain=$CORE_TEXT_DOMAIN}Database: %1{/t}{/if}
- {t domain=$CORE_TEXT_DOMAIN}Templating: {/t}{smarty_computing_time}
- {t domain=$CORE_TEXT_DOMAIN}Total: {/t}{smarty_total_computing_time}
</span>
</div>
{/if}
{/block}
{/block} {/block}
</div> </div>
</footer> </footer>