Author Topic: Translation of error message 404  (Read 168 times)

arcturus

  • Jr. Member
  • **
  • Posts: 90
  • VirtueMart Version: 3.6.6 10191
Translation of error message 404
« on: September 17, 2019, 17:56:39 pm »
Hello,

I noticed that the error message 404 is not translated.
In /components/com_virtuemart/views/productdetails/view.html.php, on lines 115
replace
Code: [Select]
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");for
Code: [Select]
header($_SERVER["SERVER_PROTOCOL"]." 404 ".vmText::_('COM_VIRTUEMART_PRODUCT_NOT_FOUND'));
on line 132, replace
Code: [Select]
throw new RuntimeException('VirtueMart product not found.', 404);for
Code: [Select]
throw new RuntimeException(vmText::_('COM_VIRTUEMART_PRODUCT_NOT_FOUND'), 404);
The line 325 from /language/en-GB/en-GB.virtuemart.ini
Code: [Select]
COM_VIRTUEMART_PRODUCT_NOT_FOUND="404 The requested product does not exist."should be modified a bit, so as not to include "404" (otherwise the line 132 above will render it twice, in case a product is not found).
Cheers,
George
https://www.proxima-mundi.ro

Now I'm using Joomla! 3.9.13 and VM 3.6.6 10191 on PHP 7.3.9

diri

  • Jr. Member
  • **
  • Posts: 78
  • VirtueMart Version: most recent dev version (trunk)
Re: Translation of error message 404
« Reply #1 on: September 18, 2019, 08:08:52 am »
You are aware of the fact that error 404 is system wide and means "page not found" (or: link not found on system, wrong link, ...) normally while "product not found" has to lead to a valid page with according message from VM only in case "product not found"?

I assume there is another error like the one you mention.

arcturus

  • Jr. Member
  • **
  • Posts: 90
  • VirtueMart Version: 3.6.6 10191
Re: Translation of error message 404
« Reply #2 on: September 18, 2019, 10:36:03 am »
Indeed, there are more such 404 cases. However, is kinda weird for some users to see errors and words they don't understand (not everyone speaks English).
I searched for "404" in Vm files and found that error strings are present in the following files:

com_virtuemart.3.6.1.10150_ext_aio\plugins\vmpayment\sofort\sofort\library\sofortLib_http.inc.php line 161:
Code: [Select]
return array('code' => 404, 'message' => $this->_xmlError($this->httpStatus, 'URL not found '.$this->url), 'response' => '');
components\com_virtuemart\views\category\view.html.php lines 694:
Code: [Select]
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");and 734:
Code: [Select]
throw new RuntimeException('VirtueMart category not found.', 404);
components\com_virtuemart\views\productdetails\view.html.php lines 115:
Code: [Select]
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");and 132:
Code: [Select]
throw new RuntimeException('VirtueMart product not found.', 404);
components\com_virtuemart\virtuemart.php lines 131:
Code: [Select]
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");and 142:
Code: [Select]
throw new RuntimeException(sprintf('VirtueMart controller not found `%s`.', $_class), 404);

I also looked for "not found" string in VM files.
administrator\components\com_virtuemart\models\config.php line 171:
Code: [Select]
vmWarn('Fonts not found in '.$dir);
components\com_virtuemart\assets\js\dynupdate.js lines 75 and 184:
Code: [Select]
alert( "page not found" );
administrator\components\com_virtuemart\helpers\image.php line 180:
Code: [Select]
vmError('Couldnt create thumb, file not found '.$fullSizeFilenamePath);
administrator\components\com_virtuemart\models\invoice.php line 379
Code: [Select]
//$data['invoice_number'] = $data['invoice_number'].' not found.';
com_virtuemart.3.6.1.10150_ext_aio\plugins\vmcustom\istraxx_download_simple\istraxx_downloader_simple.php line 267:
Code: [Select]
vmError (500, 'Downloadplugin getMedia: File not found ');
administrator\components\com_virtuemart\helpers\migrator.php lines 1344
Code: [Select]
vmWarn('Attention, order is pointing to deleted product (not found in the array of old products)');line 1939:
Code: [Select]
vmError("Port Related products: The following SKUs were not found ".implode(',',$out) );line 1961:
Code: [Select]
vmError("Port Related products: Some of those SKUs were not found ".implode(',',$skus) );
com_tcpdf_1.0.8\tcpdf.php lines 9009:
Code: [Select]
$this->Error('Font file not found: '.$ctgfile);14861:
Code: [Select]
$this->Error('EPS file not found: '.$file);and 22729:
Code: [Select]
$this->Error('SVG file not found: '.$file);
administrator\components\com_virtuemart\controllers\translate.php on line 50:
Code: [Select]
$json['msg'] = 'Table not found '.$viewKey;
administrator\components\com_virtuemart\views\product\view.html.php on line 344:
Code: [Select]
$msg= 'Parent with product_parent_id '.$product_parent_id.' not found';
administrator\components\com_virtuemart\helpers\vmlanguage.php on line 69:
Code: [Select]
vmError('JComponentHelper not found');
administrator\components\com_virtuemart\helpers\vmmodel.php on lines 546:
Code: [Select]
vmWarn( 'Model '. $name .' not found.' );and 547:
Code: [Select]
echo 'File for Model '. $name .' not found.';

So far, in the language file we have only this string:
Code: [Select]
COM_VIRTUEMART_PRODUCT_NOT_FOUND="404 The requested product does not exist."
We would also need:
Code: [Select]
COM_VM_ERROR_URL_NOT_FOUND="URL not found."
COM_VM_ERROR_404_NOT_FOUND="404 Not found."
COM_VM_ERROR_CATEGORY_NOT_FOUND="Category not found."
COM_VM_ERROR_PRODUCT_NOT_FOUND="Product not found." - COM_VIRTUEMART_PRODUCT_NOT_FOUND could have _ERROR_ added in it
COM_VM_ERROR_CONTROLLER_NOT_FOUND="Controller not found."
COM_VM_ERROR_FONTS_NOT_FOUND="Fonts not found."
COM_VM_ERROR_PAGE_NOT_FOUND="Page not found."
COM_VM_ERROR_FILE_NOT_FOUND="Couldnt create thumb, file not found."
COM_VM_ERROR_NOT_FOUND="not found."
COM_VM_ERROR_DOWNLOADPLUGIN_GETMEDIA_FILE_NOT_FOUND="Downloadplugin getMedia: File not found "
COM_VM_ERROR_ORDER_POINTING_TO_DELETED_PRODUCT="Attention, order is pointing to deleted product (not found in the array of old products)"
COM_VM_ERROR_THE_FOLLOWING_SKUS_NOT_FOUND="Port Related products: The following SKUs were not found: "
COM_VM_ERROR_SOME_OF_THE_SKUS_NOT_FOUND="Port Related products: Some of those SKUs were not found: "
COM_VM_ERROR_FONT_FILE_NOT_FOUND="Font file not found: "
COM_VM_ERROR_EPS_FILE_NOT_FOUND="EPS file not found: "
COM_VM_ERROR_SVG_FILE_NOT_FOUND="SVG file not found: "
COM_VM_ERROR_TABLE_NOT_FOUND="Table not found: "
COM_VM_ERROR_PARENT_WITH_PRODUCT_PARENT_ID_NOT_FOUND="Parent with product_parent_id %s not found"
COM_VM_ERROR_JCOMPONENTHELPER_NOT_FOUND="JComponentHelper not found."
COM_VM_ERROR_MODEL_NOT_FOUND="Model %s not found."
COM_VM_ERROR_FILE_FOR_MODEL_NOT_FOUND="File for Model %s not found."
(Some already have "404" in the string, some do not, as 404 is added via function.)
Cheers,
George
https://www.proxima-mundi.ro

Now I'm using Joomla! 3.9.13 and VM 3.6.6 10191 on PHP 7.3.9