Translate custom field list values

Hello RT community,

I have created a custom field named Gender with type Select one value and render type List. I assigned it multiple values (male, female, diverse) to it.
Now I want to translate these values to multiple languages. Translation of the custom field names itself is not a problem, but I don’t found any information to translate even the values.

Is there any way to implement this?

Can someone please help me and point me to the right direction?

If you need any further information, please let me know.

Thanks in advance.

Ronny

System information
RT Version 5.0.2
RT Extensions RT::Extension::ArticleTemplates
RT::Extension::ConditionalCustomFields
OS Ubuntu 20.04 LTS
DB MySQL

Are you looking to have the saved value be translated as well or only the displayed value?

Hi knation,

thanks for your reply.

I think, the displayed values should be okay, if they’re only be translated.

I think it’d be difficult to change the values in JavaScript as there isn’t a callback in the loop that grabs the custom field values. That or a file overlay if you’d rather write some mason code as opposed to JS

Hi knation,

sorry for the late reply. A lot of projects needs to be finished just before christmas holidays :slight_smile:

So, if I understand you right, there is no other solution than coding such a “translation” feature? Because I’m not developer and don’t have any glue where to start something like this.

I don’t think you’ve got much option other than some local development I’m afraid, because the custom field will have a constrained list of values that it can take, which won’t include the text of your translations. You’ll need to be able to change the displayed text in the selection, but not the value in the <option> element. A quick look at the 5.0.1 code seems to indicate that you might be able to hack the <%METHOD options> section of /Elements/EditCustomFieldSelect to replace the displayed value with a translation. If you make a copy of /opt/rt5/share/html/Elements/EditCustomFieldSelect into /opt/rt5/local/html/Elements/EditCustomFieldSelect and do something like the diff below it might help:

diff -c /opt/rt5/share/html/Elements/EditCustomFieldSelect /opt/rt5/local/html/Elements/EditCustomFieldSelect 
*** /opt/rt5/share/html/Elements/EditCustomFieldSelect	2021-03-22 10:42:53.686332939 +0000
--- /opt/rt5/local/html/Elements/EditCustomFieldSelect	2021-12-23 11:36:00.496674949 +0000
***************
*** 211,217 ****
  %           $$SelectedRef = 1;
              selected="selected"
  %       }
!         ><% $name %></option>
  % }
  % for (@levels) {
              </optgroup>
--- 211,217 ----
  %           $$SelectedRef = 1;
              selected="selected"
  %       }
!         ><&|/l, $name &>[_1]</&></option>
  % }
  % for (@levels) {
              </optgroup>

No promises mind - I can barely speak English let along other languages! :wink: