0

Heh guys,I am new to service now. I am doing translation in my portal for english and french.

For custom text I have done like this

Server script:

data.welcomeMsg= gs.getMessage('Welcome to the portal');


Html:

<p>{{data.welcomeMag}}</p>

It works good. when english is selected message will be displayed in english language,when french is selected message will be displayed in french(I have used messages table for translation).

Now,I am getting the following sentence from business rule not in widget level.

res.comments =' Request is pending approval from- ' + current.approver.name;

I want to translate this text Request is pending approval from here.So I tried this,

res.comments =gs.getMessage(' Request is pending approval from- ') + current.approver.name;

But text is not getting translated in portal.

Anything wrong with my code? Guys please correct me if I am wrong.

Thanks!!

krish
  • 1,077
  • 6
  • 24
  • 49

1 Answers1

1

When using gs.getMessage(...), it pulls translations from UI Messages but in my testing it doesn't match translations with leading or trailing white-space.

Try tweaking your messages a bit to see if removing those resolves it if that is what your translation has.

Change your UI Message Key from this

 Request is pending approval from- 

To this

Request is pending approval from-

Once I made that change, both of these worked

gs.getMessage(' Request is pending approval from- ')
gs.getMessage('Request is pending approval from-')
Kirk
  • 16,182
  • 20
  • 80
  • 112
  • Sorry, I missed in your question the `I have used messages table for translation`. However I did do some testing in an instance and when there are leading/trailing whitespace, the translations did not work. I've updated my answer to possibly address that part in case that helps. – Kirk Aug 22 '18 at 15:28