How to rename “Ref.” and “Label” only in Projects module?

I want to change the fields display names “Ref.” and “Label” to “Project Number” and “Project Name” only in the Projects module.

  • I tried using the global override in Translations, but this changes the labels everywhere, which I don’t want.
  • I also tried editing projects.lang directly in the core language en_US folder, which I believe is not the correct approach, but it still doesn’t work as expected.

Am I missing something? What is the proper way to safely rename these labels only for the Projects module without affecting other modules?


  1. just how important is this really?
  2. You could edit the HTML file directly and then just replace it at every upgrade

You are right; it may not be that important. However, someone still has to figure out where this is in the code, and not everyone can read the code to determine that. Also, does this not break the principle of not hacking the core? How about I create a pull request to add this, if it’s worthwhile for the sake of the community? We have the translators, but they are not being referenced in the code. Here is the change I made in html and this solved the issue, but not sure we want to this every time a new Dolibarr comes out.


are both pictures the before picture? Then we can not see the changes?

Hi @his_africa,

You can do this from here.

Or if you want to do it in the Project module only, then you will have to change the card.php page too. Add a new translation string and also add the new translation from the translation menu.

Thanks & Regards
Saikat Koley
https://www.linkedin.com/in/saikatkoley

This has been fixed. The correct “after” screenshot added.

Hi @saikatkoley, yes, this applies only to the Project module. As you mentioned, changing Ref and Label in Translations affects other modules, so we’re aligned that modifying projet/card.php is the right approach.

However, this does break the principle of not changing the core. It means that with every new Dolibarr update, someone would need to manually re-apply this change.

Another possible approach would be to use hooks, but currently there’s no hook available to change this section in Projects since these fields are hard-coded in the form. The only hook available is formObjectOptions, which only lets us add additional fields.

Do you or the community think it’s worthwhile to submit a pull request for this?

Hi @his_africa

Yes, you are right, you can use a hook and JS in that hook. Therefore, it will update the string on that page’s UI.

Thanks
Saikat Koley
https://www.linkedin.com/in/saikatkoley