Accessing translations to use within XLSForm

1. What is the issue? Please be detailed.

  • I have a form that has 3 languages: English, Ukrainian, and Russian.
  • If the form has an up-front question asking "What country are you in?", with options 'Poland', and 'Ukraine' - then I know how to use jr:choice-name to show the name of the country they selected in follow-up question labels, using the same language they entered it in.
  • However, here's my issue: in both the Ukrainian and Russian languages, the format of a noun (for example, "Poland") changes based on the context of the sentence - e.g., 'Poland' is spelled differently (different suffix ending) whether the sentence is 'in Poland' or 'is Poland'.
  • Therefore, I want to create a way to dynamically reference the correct country name, and the correct context-spelling, in multiple languages, to use in the 'question label' of follow up questions.

2. What have you tried to fix the issue?

  • I've thought of a couple ways to solve this: 1) do a sort of 'lookup' matrix in the choices-tab, where the formats of each noun needed for each question in the form have a different row, and then just put the translations for each format in the appropriate language column.
    image
  • but in order to do this, I'd need to be able to do a 'lookup' formula in the survey tab. I've used this format before to use the XPath to reference values in an instance in the choices tab:
    image
  • however, in this version, I'm not sure if I can lookup language translations?

The other thing I tried, but I don't think it's possible:

  • use the jr:itext function - but I'm not sure if this is possible from within an XLSForm, or at least I couldn't find an example.

3. Upload any forms or screenshots you can share publicly below.
Here's my XLSForm right now - apologies I've deleted and re-edited this a few times now and feel like I'm now going in circles, so reaching out for some help or brainstorm ideas!
changing_language_versions_of_nouns.xlsx (13.6 KB)

Thanks!
Janna

translated-dynamic-text is a general example of using jr:itext for translations.

If we were using raw XForms we could just create the translation block but using XLSForm the best approach is to create a choice list, as you've figured out. When there are translated strings for choices, pyxform adds a itextId reference to the translation block in the XForm. We can use that.

multilanguage itext is closer to what you've asked for. There are a couple of notes inline describing some aspects of the form which are mandatory because of implementation quirks.

This will only work in ODK Collect. Enketo does not currently implement jr:itext as a true function.

1 Like

@LN , this is exactly what I was thinking - thank you so much!! I was spinning in circles a bit. Noted that it doesn't work with Enketo.