How to set the default language (using pyxform to convert xlsx to xml)


Dear Forum,

I have been testing the output of pyxform, trying to understanding how to "impose" the language I want to use as default. I had the following issue:

  • survey and choices sheet with 2 languages (e.g. Portuguese (pt) and Español (es) ),
  • default_language set to pt,
  • portuguese columns coming first in all sheets.
  • still, xml has the Espanol label first and the phone will take it as default language

(of course you can change it from the Menu, but we wanted to have it automatic)

I realized that pyxform chooses as default language the one whose label come first, i.e., if I have a "calculate" type question with a label in Spanish (second language in my survey), but not in Portuguese (first language in the survey) pyxform will set Spanish as default.

My solution for this is to add a "calculate" variable at the beginning, and put a label only in the column corresponding to the default language that I want.

Did anybody experienced a similar issue or observed a similar behavior? Is there a better solution?


@Ukang_a_Dickson I think this might be a bug in pyxform?


We can look into this. I won't mind having an example XLSForm from Alfonso. Has an issue been created?

1 Like

Have you tried setting default_language to Portuguese (pt) rather than pt? The language code is a convention that can be used by clients but pyxform has no knowledge of it. The value in default_language should match the full language description in the column header.

If that’s still not working, I agree a sample form would help!


Thank you for all answers.

I tried the suggestion of Hélène, but this also did not work.

I have created few sample surveys. In the one attached, converting with pyxform I get a xml form in which the Spanish version comes first [wrong]

I tried two things now:
(1) remove the label in J4 and putting a label in G4 --> now the resulting XML form starts with Portuguese [correct]
(2) Just adding a label in G4 --> this results in strange behavior, sometimes the resulting form still has Spanish default [wrong]
(3) Create a new form with a new name, with both label in G4 and J4 --> Portuguese xml form. [correct]

debug.xlsx (32.4 KB)