Language switch does not work in custom print formats

Hello,

when I customize a standard print format and make the copy to a custom one the language for all fields except the item table loses it’s ability to auto-translate. This is really annoying as I have to do the complete format again in any other than my default language that I want to use.

Is there a workaround for this?

Regards

@beckerlz80 Could You share your code to help you?

Thank you for your reply!

What code do you need?
When printing for example an Invoice you can choose to create a new custom print format based on the standard one.
When I do this the copy loses its ability to auto-translate and is almost completly stuck in my display language. Only the item table header and content still gets translated.

@Mohammed_Redha
I still haven’t found a solution to my problem. Can you tell me in which py file the new print format gets generated? Maybe there is an error in there which only copies the translated string and not the placeholder?

Kind Regards

@beckerlz80 share some screenshot of your custom print format and final result and expected result to help you, please.

@Mohammed_Redha Hi, thanks for your reply!

Here are some pictures to demonstrate my issue (addresses have been removed):

This is the default print format in english:

When I switch to “Deutsch” (German) all the labes get translated automatically:

When I create a custom print format based on this format the auto translate feature is lost for all labels except the item table:

I hope this helps to illustrate the issue.

Just to clarify that the issue is not special to my custom format:
The issue starts as soon as you start a new print format with the “customize” button.
You don’t have to change a thing in the custom format.

Thank you for your help!

Hello again,

I did some research and it looks like the issue comes from the user-language being in german.
When I switched the user-language to english and did a copy of the default print-layout the text would translate automatically even after changing the user-language back to german.

Should I file an issue for git?

Regards

Should I file an issue for git?

I think so

If you create a custom print format with HTML, you have more control of the label translation. It would be a two step process:

  1. Modify or Add each and all of your labels in english like this:

{{ _("Field Label Text in English") }}

  1. Add a translation for each label created where:
    Language: Destination language for your labels
    Source Text: “Field Label Text in English”
    Target Text: “Translated text in destination language”

Once done, try changing the language and you will see the translations working.

I personally copy the text to an empty text editor when creating the print format, and then each label gets created in the translations list.

1 Like

I’ve same problem i am sharing the screenshot please have a look :

Here because of standard template the fields are changing to different language but the below part of terms and condition does not change into the targeted language any idea how to translate it also ?