getodk / build

ODK Build is a drag-and-drop form designer for ODK XForms. Thousands of users around the world depend on it for their data collection campaigns. Contribute and make the world a better place! ✨📝✨
https://build.getodk.org/
Other
110 stars 82 forks source link

Default language should contain valid language code #260

Open florianm opened 2 years ago

florianm commented 2 years ago

ODK Build uses English as default language. Exported as XForm, the import to ODK Central works fine and the form is usable - this is likely what most users will do. However, when exported via XLSForm, ODK Central shows the following warning:

This XLSForm file can be used, but it has the following possible problems (conversion warnings):

    The following language declarations do not contain valid machine-readable codes: English. Learn more: http://xlsform.org#multiple-language-support

This warning can be corrected by either manually changing the language from English to English (en) in the XLSX spreadsheet, or directly in ODK Build (Edit > Manage translations > Active language > add the (en).

florianm commented 2 years ago

This could be as simple as changing https://github.com/getodk/build/blob/master/public/javascripts/i18n.js#L13 from

    var defaultLanguages = function() { return { 0: 'English', _counter: 0, _display: '0' }; };

to

    var defaultLanguages = function() { return { 0: 'English (en)', _counter: 0, _display: '0' }; };

and possible update the "Displayed Language" in index.erb:91

Edit: the above idea does not work but may be an entry point.

Alternatively, this could be handled in build2xlsform.