Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Translation

Questions related to using nuBuilder Forte.
Post Reply
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

Translation

Unread post by marc »

Hi,

I am looking for a way to translate the fields of a form into another language. I imagine it like this: If "French" is selected in a dropdown, the labels are translated into French. If "English" is selected, the default text is displayed. In other words, the language of the logged in user should not be used. The user selects the language of the form. Can I use the inbuilt translation for this?
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Translation

Unread post by admin »

marc,

You can try this...

Code: Select all



$("[id^='label_']").each(function( index ) {

   var h = $(this).html();
   var t = nuTranslate(h);
   
   $(this).html(t);

});

I find this page very helpful when using jQuery...

https://www.w3schools.com/jquery/jquery ... ectors.asp


Steven
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

Re: Translation

Unread post by marc »

Steven, how can I set the language using your code?

I select French, from the dropdown, the GUI elements are translated to French. The same for English.
And as mentioned above, this should work no matter what language the user has set.
lang.png
You do not have the required permissions to view the files attached to this post.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Translation

Unread post by admin »

marc,

I didn't notice you say...
the language of the logged in user should not be used.
My way won't work for you.

The best thing you can do is create an array of Label names and the text to go in them - for each language.

Steven
Post Reply