question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Translations confusion with several forms on the same page

See original GitHub issue

Bug Description

We have 2 similar forms embedded in the same page. Some fields are shared, but translation is different since they reflect 2 different contexts. We are loading the forms with the standard js

Formio.createForm(document.getElementById('[id]'), 
   'https://...', 
   {"language":"en","i18n":{"de": [....] }}}
 ).then(function(form) { 
    ....
    form.language = 'de';
    .... } ) 

This code is repeated twice. Each form is displayed in a tab (but same issue is observed if both forms are just one after the other).

Randomly a form is not translated whereas the other one is correctly translated, or the translations of one form is applied totally or partially to the other one. Of course, this second flavor of the issue only concerns translations of identical keys.

Environment

  • Hosting type
    • [] Form.io
    • [x ] Local deployment
      • Version:
  • Formio.js version: Latest (currently: v4.1.0)
  • Frontend framework: Rails
  • Browsers: Chrome 77 on OSX 10.13 and 10.14, Chrome 67 on Chromebook and also Firefox, safari. It looks like something may be related to how forms are redrawn. For example when previously hidden fields are displayed, the translation is almost always the wrong one.

Example

Page with 2 tabs and 2 forms: https://www.switchup.de/v2/widgets/is24/recommendations

The form is in German, but it’s easy to spot the confusion. There are strings with “Strom” that should be displayed only on the “Strom” tab and other strings with “Gas” that should be displayed only on the “Gas” tab.

Another way to spot is to reload several times. The translations of the buttons in the “Strom” tab will change.

Source of form 1: https://mitra.switchup.de/forms/electricity-is24.js?selector=mytab

Source of form 2: https://mitra.switchup.de/forms/gas-is24.js?selector=mytab2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Vedhachalacommented, Jul 27, 2020

@travist @shawnbot Thanks for the help. The first method worked for me.

0reactions
travistcommented, Jul 22, 2020

You should be able to pass along this option using the renderOptions parameter within the Angular component like so.

<formio [form]="formJSON" [renderOptions]="{
  i18next: i18NextInstance
}"></formio>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Plural-Forms conflict - WordPress.org
In Latvian, there seems to be at least two different “Plural-Forms” being used. WordPress translations from https://translate.wordpress.org/ are set up with
Read more >
How to Make Your Forms Multilingual - Jotform
How to Make Your Form Available in Multiple Languages · Go to the Settings tab in the Form Builder. · Click the Show...
Read more >
Hint NOT Working in Formbuilder for multiple languages ...
Workaround is to download XSL and change column name to guidance_hint::language (dafault), than re-import. ... From know on all works fine: ...
Read more >
Unable to add more than one form to the same page
Answer: Multiple forms on the same page will cause errors when trying to submit the form. Thus, multiple forms cannot be added to...
Read more >
Using WPML for Multilingual Forms
Translate your forms into multiple languages using WPML and the ... Publish your form on a page and use WPML to translate the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found