The translate does not work in list view


in the right side is the designation doctype its data does not translate in the view list
this is the example of translate doc in the left side

but when open the doc the translate is worked

how to display the translate in the list view??

Enable this on doctype

image

1 Like

i was checked

any one solve this issue?

It seems that the problem lies in the List View JS file, where the code responsible for applying translations is executed in a limited manner. This happens because the translation logic is within a conditional block that is applied only if df.options is explicitly listed in translated_doctypes.

For example, I would like the Report DocType ID to be translated:

But hereā€™s the code as it is:

By adding the __() function to the value_display variable, the strings were successfully translated.

However, I am not proficient in JS, and I believe this might not be the proper solution. Obviously there must be a reason to be the way as it is.
Does anyone know the best approach to handle this?

Maybe even via Client Script?

you edit in the core ?
are you sure from this
i suggest the solve is to edit the core code in frappe repo itself

no need to edit the core its working fine for me

which document u r using?

designation
in HR

Well, I was just testing locally because Iā€™m running into the same issue with doctypes created by Frappe / ERPNext, like Report and Country.

Some of them are standard and donā€™t let you check the ā€˜translate link fieldsā€™ option. I tried using the Property Setter (via custom app), but that didnā€™t work either. And even for the non-standard doctypes, checking the box didnā€™t solve the problem. :smiling_face_with_tear:

So, I tried to figure it out if the issue was in the code, and what I did solved my problem, but Iā€™m not willing to change the core in a fork or suggesting code changes to frappe repo without being sure of what Iā€™m doing. Like I said, Iā€™m not proficient in JS or a front-end developer. Maybe there is some other way around, just trying to figure out and maybe get some help :sweat_smile:

as far as i know you can use jinja templeting for translations like if its static text use {{(ā€œyour text hereā€)}} and if dynamic use {{(your text here)}}

Nice, thanks! I havenā€™t tried Jinja yet, but Iā€™m reading through the docs and will give it a shot. Iā€™ll come back with feedback once Iā€™ve tried it out. :smiley:

In the end, I didnā€™t use Jinja. The following client script did the job:

frappe.listview_settings["Report"] = {
    formatters: {
        "name": function(value, doc) {
            return __(value);
        }
    }
};