"Make" and "Status" Button translations on different DocTypes

ERPNext works great with different translation packages, however I have noticed that when using español or Español (Perú) it does not translate to spanish, it remains in english (default)

For this particular example, I have a DocType Purchase Order which has been validated and its status is To Receive and Bill. On the top right, just below “Menu” and “Cancel” (which also translate properly by the way), both “Status” and “Make” buttons are shown, and their buttons inside are:

  • Status: Stop, Close

  • Make: Receive, Invoice, Payment

    Thus, my intention is to translate all the text as shown in the list above to show like this:

  • Estatus: Detener, Cerrar

  • Hacer: Recibo en bodega, Factura, Pago

I have so far found some button definitions in the
erpnext/erpnext/buying/doctype/purchase_order/purchase_order.js

More specifically, line 81, 66, 75 and 79 for the “Make” menu items, with a statement as such.
cur_frm.add_custom_button(__('Receive')

I could obviously change the text directly, but I am wondering how to create some sort of variable that one can access from the translation files, so that it is used on load according to the preset language for ERPNext users.

Or do I just simply modify another file for these particular button labels?

Thanks!

Translations are loaded directly from the translation files in app/translations/ into the JS and and are replaced by the __('text') function

1 Like

So, I have opened up the translation file, and I have played around with the text, but it does not seem to change. I have restarted the server, refreshed the cache, reloaded the page and the text displayed is the same, the translation changes do not work. I am using es_PE.csv and the language setting for my user is español(Perú) I must be doing something terribly wrong!

Try debugging it.

Can you see the translation dict appended in your doctype request?

@rmehta Success! I managed to convert directly the .csv files, and the translations are working successfully now. The problem was with the translation file itself.

My problems were these:

  1. I had initially, by accident, run the setup script on a non-root user, so I was modifying a duplicate, wrong directory. I am now working on the correct one at root$ /home/…
  2. I was unaware that the translation dictionary gets loaded onto memcache, for more efficient serving of the data. Thus, even when I updated, and tried clearing the cache, it did NOT clear. I resorted to restarting the server, and that made my changes go live!

I have noticed that the .csv files refer to .js files with numbers at the end, like so:
apps/erpnext/erpnext/buying/doctype/purchase_order/purchase_order.js +603,Receive, Recibir
They seem to be irrelevant to the actual translation, are they indexes from the translation project?

Thanks!

@Tropicalrambler You were able to translate the button? I’m with the same issue.
Thanks in advance.

Currently, I have reverted to a custom translation, and this works pretty well. Make sure you have as many custom translations for each variation of es that you want to use. Desk > Setup > Cusotm Translations > New.

Below is a series of images showing the process that has worked for us.

The menu item is in the image below, under Customize:


It’s works, thank you so much @Tropicalrambler.