Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This article will explain how you can show translated surveys for web-view forms. The below example is for the specific SDK Android case. The way data is sent along differs per SDK type, below you can also find the different ways to send along extra data per SDK type:

Info

SDK iOS: https://github.com/mopinion/mopinion-sdk-android#extra-data

SDK iOS Web: https://github.com/mopinion/mopinion-sdk-android#extra-data

SDK Android: https://github.com/mopinion/mopinion-sdk-android#extra-data

SDK Android Web: https://github.com/mopinion/mopinion-sdk-android#extra-data

Note

Please note that it is not possible to translate native app forms. In this case, separate forms should be made.

...

Note

The below example is for the specific SDK Android case, the way data is sent along differs per SDK type.

When using SDKs, it is possible to send along extra data:

Code Block
import com.mopinion.mopinionsdk.*;

Mopinion M = new Mopinion(this, "12345abcde");
M.data("first name", "Andy");

...

The values sent along can also be used to determine the translation that should be used for the survey.

For example:

Code Block
M.data("lang", "fr"); 

In the survey builder, you can add a translation for this language and trigger that translation based on a JS variable.

The lang key will be part of the metaData object so you have to check for the value of metaData.lang :

...

Easy html macro
theme{"label":"solarized_dark","value":"solarized_dark"}
contentByMode{"html":"<div id=\"surveyContent\"></div>","javascript":"var confluenceData = {};\nvar pageId;\nvar pageTitle;\n\ntry {\n confluenceData = JSON.parse(parent.window.name);\n var pageId = confluenceData.options.productContext['page.id'];\n var pageTitle = confluenceData.options.productContext['page.title'];\n} catch(e) {}\n\nvar src = 'https://collect.mopinion.com/assets/surveys/2.0/js/survey.min.js';\n\nvar vars = {\n key:'211a4fdb96626776846147095cc335b448e20458', \n domain:'app.mopinion.com', \n divName:'surveyContent', \n button:false, \n use_collect:false, \n useQuerySelectorAll:false\n};\n\nvar s = document.createElement('script');\ns.async = 'async';\ns.id = 'mopinionFeedbackScript';\ns.src = src;\ns.onload = s.onreadystatechange = function() {\n if (!s.readyState || s.readyState === 'loaded' || s.readyState === 'complete') {\n try {\n srv.loadSurvey(vars);\n } catch (e) {}\n }\n}\ndocument.head.appendChild(s);","css":""}