How to translate a sentence with a link

This forum allows users to post and respond to "How Do I Do ....." questions. The information contained in this forum has not been validated by K-Rise Systems and, as such, K-Rise Systems cannot guarantee the accuracy of the information.
CathyC
Posts: 472
Joined: November 16th, 2021, 11:15 am
Contact:

How to translate a sentence with a link

Unread post by CathyC »

I have a sentence with a link in it and it all needs to be translated.
sentence in english.png
sentence in english.png (3.35 KiB) Viewed 2620 times
sentence in english.png
sentence in english.png (3.35 KiB) Viewed 2620 times
So I want it to look like this
sentence in german.png
sentence in german.png (7.5 KiB) Viewed 2620 times
sentence in german.png
sentence in german.png (7.5 KiB) Viewed 2620 times
but to achieve this, I have 3 records in the translation dictionary
translation (1).png
translation (2).png
translation (2).png (9.86 KiB) Viewed 2620 times
translation (2).png
translation (2).png (9.86 KiB) Viewed 2620 times
translation (3).png
I would prefer the full sentence to be translated as 1 dictionary record because the english sentence broken into 3 parts, translated, and put together, will not always be form a coherent translated sentence. And as we roll out more languages, I'll provide the dictionary records to someone who speaks the new language and they will see these rows in an excel:
  • for how we process personal data.
  • global privacy notice
  • This email may contain confidential information and is intended only for the addressee. You may not disclose such confidential information. If you have received this email by mistake, please notify the sender and delete this email. See our
These 3 rows will be separated by many rows in between so it is not obvious what the other part of the sentence is for context.

Here is how the translation is happening. its formed in a CreateServiceNode and dynamically put in a html generic control
dynamic logic.png
Are there any suggestions for how I could do this better?
Last edited by CathyC on May 3rd, 2023, 11:05 am, edited 3 times in total. word count: 260

Tags:
CathyC
Posts: 472
Joined: November 16th, 2021, 11:15 am
Contact:

Re: How to translate a sentence with a link

Unread post by CathyC »

I talked with some other developers on this and got a good answer:


Here is the sentence I have in English. The words "global privacy notice" are a hyperlink
This email may contain confidential information and is intended only for the addressee. You may not disclose such confidential information. If you have received this email by mistake, please notify the sender and delete this email. See our global privacy notice for how we process personal data.
to translate I should:
  1. have the logic in a method and make a create service node with 2 nodes:
    • This email may contain confidential information and is intended only for the addressee. You may not disclose such confidential information. If you have received this email by mistake, please notify the sender and delete this email. See our ##### notice for how we process personal data.
    • Global Privacy
  2. Then pass both of these through the Translate service
  3. Use a replace service to swap the translation of "Global Privacy" out for the ##### variable.
  4. Put the complete sentence in some sort of "Output" CreateServiceNode to put it where it should go on the page
word count: 186
CathyC
Posts: 472
Joined: November 16th, 2021, 11:15 am
Contact:

Re: How to translate a sentence with a link

Unread post by CathyC »

So I implemented the design I mentioned
image.png
Translate Privacy Notice:
image.png
TranslateLinkText:
image.png
PrivacyLink:
image.png
CombinePrivacyTranslation Attempt 1:
image.png
This looks like it works
Here is its output:
image.png
But when I reference it, it doesnt grab the text the a tag, so only the text "global privacy notice" shows up
image.png
CombinePrivacyTranslation Attempt 2:
image.png
This one throws an exception:
image.png
I'm not sure what my next step should be, but I feel like I'm close here.
Here is a comment where a previous developer just wrote out all the html and said he used CDATA so EASYProcess would like it. I think because of how I'm putting it together now, I dont have the opportunity to do that so I'm running into those issues
image.png
word count: 122
CathyC
Posts: 472
Joined: November 16th, 2021, 11:15 am
Contact:

Re: How to translate a sentence with a link

Unread post by CathyC »

The previous comment was happening like that because I had this reference:
image.png
I removed the * because that was saying to select all of CombinePrivacyTranslation/Output/Result/PrivacyNotice's children
Here you can see that selects only the a tag, so that makes sense.
image.png
However now that it is selecting all of PrivacyNotice node, it is no longer getting the link, just the text:


image.png
Here it is on the page where it loads:
image.png
image.png (8.08 KiB) Viewed 2568 times
image.png
image.png (8.08 KiB) Viewed 2568 times
word count: 88
CathyC
Posts: 472
Joined: November 16th, 2021, 11:15 am
Contact:

Re: How to translate a sentence with a link

Unread post by CathyC »

Here is the latest update with this:
----------------------------------
Bug 1 - Translate service run in step throws exception
The Translate services are throwing exceptions when I run in step and load from the UI with desktop view
image.png
This is probably unrelated though because when I ran it from the site, I still got the text and there is no exception. This limits my testing so having to actually create an order each time though instead of running in step so I'd still appreciate some attention to it.
I might be missing something. Im just running the existing code in step which I think used to work. It doesnt have any variables inside the service
----------------------------------


As for the issue from my last post, where it would translate alright but the link would not work, we found in a call with the internal team that the html had CDATA everywhere and a comment at the top from the previous developer:
"Wrapped entire thing in CDATA so EP likes it"

I undid this to see what EP didn't like about it and found it:
image.png
image.png
So all over where it has some html tag with a reference for an image or url that is set to an xsl value of, I had to put that in a previous CreateServiceNode to create the html and reference that in the final html
image.png
image.png
But this solution treats my 2 scenarios differently.

Here it is after the createservicenode is ran for the footer image which is only an img tag:
image.png
Here it is after the createservicenode is ran for the facebook logo. This is an a tag with a span and img tag inside of it:
image.png
Bug 2 - Cant get social media icons to display on page

Here is how I reference it in the html (with a /* in the xpath):
image.png
And here is how it ends up after the datasource logs:
image.png
and on the page, it doesnt show the logos at all:
image.png
image.png (1.03 KiB) Viewed 2545 times
image.png
image.png (1.03 KiB) Viewed 2545 times
(this says "follow us on", and it should have the logos right next to it)

And if I change it to a /. in the xpath, here is how it ends up in the datasource logs:
image.png
and on the page, it shows that html on the page:
image.png
The footer image is working now though! So it seems the fix should be somehow to get the CreateServiceNode to output the facebook html the way it is outputting the footer image (still as xml)
word count: 422
CathyC
Posts: 472
Joined: November 16th, 2021, 11:15 am
Contact:

Re: How to translate a sentence with a link

Unread post by CathyC »

Bug 3: Translation is missing text

A new issue with this page is that when translated, text seems to be missing.

English: All orders received via our online platform is a valid official PO.
German Translation as shown in Google translate search: Alle Bestellungen, die über unsere Online-Plattform eingehen, sind gültige offizielle Bestellungen.
image.png
How it displays on the page from desktop view:
image.png
image.png (6.93 KiB) Viewed 2542 times
image.png
image.png (6.93 KiB) Viewed 2542 times
How it displays in an email when sent through the application:
image.png
I looked at the past history of this project and saw this was an issue before, raised May 4th 2022. Not sure if this helps, but figured I would mention it
image.png
word count: 122
CathyC
Posts: 472
Joined: November 16th, 2021, 11:15 am
Contact:

Re: How to translate a sentence with a link

Unread post by CathyC »

I discussed this with the internal team and my approach would not work with the legacy XML processing:
image.png
The solution was to remove the CDATA, but edit it using xsl attribute so it could be added directly in the html:
image.png
this worked and showed like required:
image.png
word count: 46
SumanPrasad
Posts: 88
Joined: August 26th, 2021, 5:21 pm
Contact:

Re: How to translate a sentence with a link

Unread post by SumanPrasad »

Task 10640 is raised to solve bug 1 and bug 3 listed. We will wait for your more testing on Bug 2.
word count: 22
JustinVanRegenmorter
Posts: 572
Joined: August 26th, 2021, 9:56 am
Contact:

Re: How to translate a sentence with a link

Unread post by JustinVanRegenmorter »

Task 10640 has been closed and issue #1 will not be supported currently. Once more information is known about issue #2 we will create a new task for it.
word count: 29
CathyC
Posts: 472
Joined: November 16th, 2021, 11:15 am
Contact:

Re: How to translate a sentence with a link

Unread post by CathyC »

issue #2 is solved. I was able to get it to work

issue #1 was the translate service not working in step, right?
I dont expect it to actually translate, but when i ran in step it was throwing an exception. not sure if it still is, but it didnt always do that. so that bug was just to get it to stop doing that. it was fine if it returned english still
word count: 73
Post Reply