Jump to content

Prestashop 8.0.2 - PDF Invoices will only generate in English


Jontee

Recommended Posts

Hi!

I have upgraded to Prestashop 8.0.2 and just realized that when I generate a PDF Invoice or Delivery Slip, their translations are always in English, even tough my shop only has one language (Swedish) and then of course the Super Admin also only has Swedish set as profile language.

The PDF strings are translated in the back officel, as can be seen in "International > Translations > Front Office > Core (No theme choosen) > Swedish.

I have tried creating a new admin profile, reset the cache through BO, cleared the cache in FTP, installed a second language and switched to in admin profile, etc., nothing helps, the Invoice and Delivery Slip PDF are ALWAYS generated in English.

What could be causing this? :(

Many thanks in advance.

Best regards,

Jonte

Link to comment
Share on other sites

Kindly try by commenting the below code in file : OrderInvoicePdfGenerator.php, path : \src\Adapter\PDF\OrderInvoicePdfGenerator.php

Hook::exec('actionPDFInvoiceRender', ['order_invoice_list' => $order_invoice_list]);

Function : generatePDF()

If the above solution doesnt work and you are using only 1 language at your store, then you can directly make changes in the following path :  PDF.php

Path : classes\pdf\PDF.php

Function : render()

Replace below code 

$this->pdf_renderer->setFontForLang(Context::getContext()->language->iso_code);

with

$this->pdf_renderer->setFontForLang([ISO_CODE_OF_YOUR_LANGUAGE]);

 

Link to comment
Share on other sites

Hi,

Many thanks for your reply.

I have tried both of your suggestions.

The first one didn't work unfortunately, and the second one resulted in error 500 when trying to generate a invoice in backend. :(

I don't understand what is causing this, I am only using one language, Swedish, and all of those language strings has been translated for years.

Best regards,

Jonte

Link to comment
Share on other sites

Hi,

I have tried with:

$this->pdf_renderer->setFontForLang(EN);

$this->pdf_renderer->setFontForLang([EN]);

$this->pdf_renderer->setFontForLang(SV);

$this->pdf_renderer->setFontForLang([SV]);

$this->pdf_renderer->setFontForLang(SE);

$this->pdf_renderer->setFontForLang([SE]);

...just to be sure.

Neither works unfortunately, resulting in error 500.

I am thinking, even if it would work, what could be the initial cause of the problem? I have also tried clicking "reset" of all the language string in "ShopPDF" translations in backend, and they reset but the PDF is still generated in English for the different sections.

Best regards and thanks in advance,

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...