Translate custom labels on invoice template

Hi,

I have some trouble trying to translate my invoice template.


In this screenshot, you can see that i’ve already added payments lines to the bottom of the template. However, i don’t really understand how does the PDF is translated.
Is there a specific function to use ? Or where do I need to add my custom strings ?

Best regards,
Dylan

Hi,

Which string are you trying to translate?

Note: it’s important to test by viewing the PDF in the client portal using the “view in portal” link.

Hi Hillel,

I’m trying to translate in french my custom table labels : “Payment date”, “Payment method”, “Transaction reference” and “Amount”. To be honest, I don’t want to type raw french strings in my code…
image
Anyway, i’ll have to translate payment method names. As in my first screenshot, these are values from the database (Check, Bank Transfer etc…). So I don’t really know where to look in the code.

1 Like

Perfect, the 4 labels that I needed where already defined !
The last thing I need is to translate payments methods that came from database.
Here is how I retrive it in app\Http\Controllers\AccountController.php

I think my lack of knowledge of Laravel is the major issue here since it looks easy with this function
__("My string to translate to locale")
I’m maybe doing it the wrong way too…

image

Can you explain me how do you translate those generic datas ?

Sorry, I don’t have the answer

I found a correct way to do it with the trans() function.

Then I checked if what I was looking for was already translated, which was the case as in the screenshot below.

resources\lang\fr\texts.php

Then, I’ve put my query results in the trans function with the right key.

Et voila, I got my lines translated.

1 Like

Nice, thanks for sharing the solution!

1 Like