ticket #097414 Fix: Use client language
gitea/hedera-web/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2023-07-28 13:11:33 +02:00
parent bb4e348d0c
commit d37493b081
4 changed files with 17 additions and 8 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (23.30.1) stable; urgency=low
hedera-web (23.30.2) stable; urgency=low
* Initial Release.

View File

@ -1,6 +1,6 @@
{
"name": "hedera-web",
"version": "23.30.1",
"version": "23.30.2",
"description": "Verdnatura web page",
"license": "GPL-3.0",
"repository": {

View File

@ -1,6 +1,7 @@
<?php
use Vn\Lib;
use Vn\Lib\Locale;
use Vn\Web\Security;
use Vn\Lib\Type;
@ -36,13 +37,17 @@ class Query extends Vn\Web\JsonRequest {
while ($db->moreResults() && $db->nextResult());
if ($db->checkWarnings()
&&($result = $db->query('SHOW WARNINGS'))) {
$sql = 'SELECT `description`, @warn `code`
FROM `message` WHERE `code` = @warn';
&& ($result = $db->query('SHOW WARNINGS'))) {
$sql =
'SELECT IFNULL(i.`description`, m.`description`) `description`, @warn `code`
FROM `message` m
LEFT JOIN `messageI18n` i
ON i.`code` = m.`code` AND i.lang = #
WHERE m.`code` = @warn';
while ($row = $result->fetch_object()) {
if ($row->Code == 1265
&&($warning = $db->getObject($sql)))
&& ($warning = $db->getObject($sql, [Locale::get()])))
trigger_error("{$warning->code}: {$warning->description}", E_USER_WARNING);
else
trigger_error("{$row->Code}: {$row->Message}", E_USER_WARNING);

View File

@ -54,8 +54,12 @@ class RestService extends Service {
if ($e->getCode() == 1644) {
$eMessage = $e->getMessage();
$tMessage = $db->getValue(
'SELECT `description` FROM `messageL10n` WHERE `code` = #',
[$eMessage]
'SELECT IFNULL(i.`description`, m.`description`) `description`
FROM `message` m
LEFT JOIN `messageI18n` i
ON i.`code` = m.`code` AND i.lang = #
WHERE m.`code` = #',
[Locale::get(), $eMessage]
);
if (!$tMessage) $tMessage = $eMessage;
throw new Lib\UserException($tMessage, $eMessage);