Translation: subfile options (Subfile Enhancer)

Use this Forum to post your “How to …” questions about your use of aXes. This is not a technical support forum. Both the aXes Support Team at LANSA and other aXes customers may answer your questions. LANSA cannot guarantee the accuracy of any information posted by customers.

Moderator: jeanmichel

Post Reply
Franck.A
Posts: 19
Joined: 06 Nov 2020, 19:33

Translation: subfile options (Subfile Enhancer)

Post by Franck.A »

This topic is about 2 nice functionnalities in aXes that we can't mannage to make them work together:

- function 1 : translation
we use CTEXT() function to run translation across our system
Our Dictionnary file(Texts_Cust_en.txt) is done so that we translate from French (native langage) to English(target langage)
This function works well on most of our screens as soons as we respect the definition rules.

- function 2 : Subfile enhancer + Subfile Options Context Menus
we use this native eXtensions to ehance our subfiles and to be able to have subfile options in a list when right-click on a selection


- Definition of our issue
Image

As the picture shows: all texts are translated to english, but the subfile option is not translated (in both positions; top of the subfile and in the mouse-click list)

We have tried to add many tranlations in the Dictionnary, that I list here:
"5=Visualiser" , "5=Visualize"
"Visualiser" , "Visualize"

But none of them do the trick.

If we try to run the function: CTEXT("5=Visualiser") in a script, then we can see the translation "5=Visualize", so we think that it is not a problem with CTEXT(), but with the Subfiles eXtentions.

Our problem is that we cannot find the source code of this eXtentions (native eXtensions), so we cannot see if the CTEXT function is used or not.

For the moment we have ask for assistance from the helpdesk about this native eXtensions
Another solution would be to code a script that would run after the eXtensions (autogui?) and translate the options, but we are beginners and I woud not say that we can do such a trick for the moment :)

If anyone has experienced this issue and could help ups, would be a great and needed help.

Thank you for reading,
Best regards
Franck
Fairdinkum
Posts: 128
Joined: 24 Jul 2017, 17:02

Re: Translation: subfile options (Subfile Enhancer)

Post by Fairdinkum »

Hi Franck,

I just took a look into this and found something seems to be hints of this topic.

1. Subfile Context Menu fanctionality is coded in /ts/js/axextensions.min.js.
2. The CTEXT function is not implemented in the code generating context menus.

I've added the CTEXT function into it for testing and it looks it is working ax expected. Here is the steps I did.
1. Backup axextensions.min.js and modify as follows.
Image 836.png
Image 836.png (829.27 KiB) Viewed 7243 times
The original code is:

Code: Select all

r.innerHTML=o[1]
And change it to:

Code: Select all

r.innerHTML=TEXT.dev(o[1].trim())
2. Add the following translation pairs into Texts_Dev_en.txt
Image 837.png
Image 837.png (75.58 KiB) Viewed 7243 times
3. Clear the cache and test on it with "lang=en"
Image 835.png
Image 835.png (253.13 KiB) Viewed 7243 times
As you can see from the screen shot above, "2=Change" and "3=Copy" are traslated.

Hope this helps!

Regards,
Hide
Franck.A
Posts: 19
Joined: 06 Nov 2020, 19:33

Re: Translation: subfile options (Subfile Enhancer)

Post by Franck.A »

Hello Hide,

Big Thanks again for the time you spent on this issue,

I updated our extension and it works but: TEXT.dev function does not translate our text
I can confirm the code is running with the navigator devtools, but the result is the french translation (with "en" url)

I have run a test to show this :

- test 1 : Button + caption = CTEXT("Visualiser") ; I can read caption = Visualize
- test 2 : Button + caption = TEXT.dev("Visualiser") ; I can read caption = Visualiser (means no translation)

I assume that TEXT.dev does not know what is the language wanted, at the moment of its execution.

Thank you for showing me where was this code, I think I can learn a lot by reading it; will update the post if I find something

regards,
Franck
Fairdinkum
Posts: 128
Joined: 24 Jul 2017, 17:02

Re: Translation: subfile options (Subfile Enhancer)

Post by Fairdinkum »

Hi Franck,
I didn't explain much about in my earlier post and it confused you. Sorry about that. m(__)m

TEXT.dev() is an internal function and it refers Texts_*Dev*_LL.txt (not Texts_*Cust*_LL.txt). This might a reason why there were different results in your "text 1" and "text 2".

I tried implementing TEXT.cust() into axextensions.min.js instead of TEXT.dev() and then got an expected result. See the screen shot below.
Image 842.png
Image 842.png (215.64 KiB) Viewed 7214 times
Texts_Cust_en.txt
Image 845.png
Image 845.png (11.27 KiB) Viewed 7214 times
Where I changed in axextensions.js were:

(1) Subfile Options
Image 843.png
Image 843.png (17.31 KiB) Viewed 7214 times
(2) Subfile Context Menus
Image 844.png
Image 844.png (17.91 KiB) Viewed 7214 times

The following site would be helpful to beautify/minify .min.js files.
https://www.prettifyjs.net/


Important:
- I'm not sure whether these modifications are acceptable. (Personally I think It makes aXes more attractive.)
- This js file will be overwritten without any notifications when applying a patch/fixpack or upgrading its version.

HTH!

Regards,
Hide
Franck.A
Posts: 19
Joined: 06 Nov 2020, 19:33

Re: Translation: subfile options (Subfile Enhancer)

Post by Franck.A »

Hello Hide,

I will update this post later, to give feedback to the other forum users, for the moment just wanted to tell you that it works !

Image

Image


I'm online with Lansa Support to make this official, and we definitly apply this method.

You are very good at Axes, big respect for this and your help

Franck
Post Reply