From 37aaad68102a4e30b7f6bb08f29a8eef8bddc794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 28 Aug 2025 04:04:41 +0200 Subject: [PATCH] avoid untranslated dol_print_error (#35104) Co-authored-by: Laurent Destailleur --- htdocs/master.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index c64fad608b9..927c3987b56 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -11,6 +11,7 @@ * Copyright (C) 2011 Philippe Grand * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2024-2025 MDW + * Copyright (C) 2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -157,6 +158,9 @@ if (!defined('NOREQUIREDB')) { $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int) $conf->db->port); if ($db->error) { + if (is_object($langs)) { + $langs->setDefaultLang('auto'); + } // If we were into a website context if (!defined('USEDOLIBARREDITOR') && !defined('USEDOLIBARRSERVER') && !empty($_SERVER['SCRIPT_FILENAME']) && (strpos($_SERVER['SCRIPT_FILENAME'], DOL_DATA_ROOT.'/website') === 0)) { $sapi_type = php_sapi_name(); @@ -165,7 +169,6 @@ if (!defined('NOREQUIREDB')) { } print '
'; if (is_object($langs)) { - $langs->setDefaultLang('auto'); $langs->load("website"); print $langs->trans("SorryWebsiteIsCurrentlyOffLine"); } else {