You are viewing limited content. For full access, please sign in.

Question

Question

Dual/Multi-Language Form

asked on February 14, 2023

My team is currently working with a European company on a Form based task process. One of the requirements is support for dual-language, and perhaps in future multi-language. To be specific, the request is that a user can present a version of the Form in their preferred language, and the field labels as well as prescribed field elements like checkbox, radio button, and drop down options will all translate.

This requirement is not really possible to achieve with purely out of the box features, unless you exaggerate the number of fields and elements on each form substantially. At the moment we see 3 key choices:

1. Show both languages simultaneously, with no option to choose. This is the simplest and cheapest solution but provides no way to hide the language that is not preferred, and doesn't display well for checkboxes, radios, and drop downs.

2. Field rule based display. Create field labels in each language for each field, and display/hide based on a user selection for langauge. This works only for labels, and the user "preference" will be saved as a variable and carried through the process for other users rather than acting as a true preference. Requires a substantial increase in forms elements, specificaly HTML boxes for the labels.

3. Code based display. Create a "library" of translations, create a "languages" button, and on click run javascript to read the pages strings and do a string replacement based on the library. Works well for all field types and labels, doesnt require any extra fields, but requires the maintenance of a backend library and substiantially more testing and maintenance for long term operations. For example version updates may break this code. Is also far harder to edit and maintain for power users who do not have coding experience.

0 0

Replies

replied on February 14, 2023

Hi Nathan,

I would suggest looking at using the Google Translate option discussed in this thread:

https://answers.laserfiche.com/questions/174416/Form-In-Multiple-Languages#196131

Its a super easy way to incorporate multiple languages into a Laserfiche form without the need for mulitple forms and such.

Here a couple publicly assessable forms with it implemented as examples:

https://forms.pampaisd.net/Forms/Learning-Commitment_20-21_TEST

https://ts-lf.docsonthecloud.com/Forms/Jr5jC

https://drivingschool.okc.gov/Forms/dsregistration

 

 

2 0
replied on February 14, 2023

@████████ has pointed you to the best answer, and it's super easy to implement.  However, keep in mind, that it's going to require the Classic Designer to implement.  If you're on Forms 11 Update 3 and wanting to implement this in the New Designer, you're going to find that it will not work, because custom Javascript in the New Designer runs within a sandboxed iFrame and therefore cannot directly access the form/document/window structure.  Therefore, the code that pulls in the Google Translate API and links it to the custom HTML element on the form won't work.  So although it is a great option and super easy to implement, stick to the Classic Designer to do it.  Have a great day!

2 0
replied on February 15, 2023 Show version history

Hi Nathan,

Both Troy & Matt has provided solutions that could be used to support dual or multi language features for Laserfiche Forms. 
Code based display is something that is quite easy to implement & to maintain, and similar to what Matt said, you would have to make this using Classic Designer.

You'll need to prepare a key value mapping (for the dual/multi language you want for the form) and then add language detection on the browser.


See the code below:

 {
    "en-GB": {
        "TEXTFIELD": "Text Field",
        "TEXTAREA": "Text Area",
          "RADIO_BUTTON": "Radio Button",
      "CHECKBOX": "Checkbox",
      "DROPDOWN": "dropdown",
      "FILE_UPLOAD": "File Upload"
    },
  "zh-HK": {
        "TEXTFIELD": "文本域",
        "TEXTAREA": "文本區",
          "RADIO_BUTTON": "單選按鈕",
      "CHECKBOX": "複選框",
      "DROPDOWN": "選項",
      "FILE_UPLOAD": "文件上傳"
    }
};
  
 window.localize = function(lang)
 {
   if (window.localizationScript)
   {
     for (var key in window.localizationScript[lang])
     {
       $('li[attr="'+key+'"] label > span').text(window.localizationScript[lang][key]);
     }
   }
 }

$(document).ready(function(){
  
  //browser language detection
  var language = window.navigator.userLanguage || window.navigator.language;
    console.log(language); //works IE/SAFARI/CHROME/FF
  
    var lang = language;
  
  window.localize(lang);
  $('.switch input').click(function(){
        
      window.localize(lang);
      //lang = lang == "en" ? "chi" : "en";
    });
});

I hope this helps!

Forms.png
Forms.png (31.7 KB)
1 0
replied on January 31, 2024

Here is a video that shows one way to accomplish this. If you go to the YouTube video page, there is a link in the description to download the Forms processes.

1 0
replied on February 1, 2024

Here is part 2 of this solution:

0 0
replied on May 15, 2024

There is now a version 2 of this solution.

0 0
replied on January 24

The videos Blake has created work wonderful. 
I have found when a field is populated with a DB Lookup, the translations break. 
I had to make the field a drop down and enter the values (150 by csv import). This allows the Google Translate to translate all values on the form.

Note: DB Lookup fields will not get translated.

0 0
replied on January 24

Are you saying that the values of the DB lookup aren't translated or the field label?

0 0
replied on January 24

The Field Label is translated.
The values of the DB Lookup are not translated.

0 0
replied on March 25, 2024

...but how do we save to the repository in another language using Google Translate. That is what I want to know...

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.