Missing default language warning

As noted here - https://github.com/XLSForm/pyxform/pull/365 we need to design the UX before we implement the feature, so here is what I am going to target.

User experience
Warnings will appear in the command line for each question missing a translation with the text
Edited 4/4/20
"Missing translation for content on question!
Question name: {question_name}
Content type missing translation: {content_type}
Missing translation for: {language} "

Then, ONLY if default language is not set
"Default language not set. Please consider setting a default_language in your settings tab to insure questions and options appear as expected."

Technical notes
I want to detect in the code where a - is being set on a field. If I can confirm this field will be displayed with that - I will add the warning there. (original form available here Adding media column results in blank screen )

Originally, I used a warnings list as an attribute to the class Survey and just adding warnings as appropriate. Let me know if anyone has a better idea.

Please LMK if the above makes sense or if it can be improved.

This would've been a good question when I first started working on issue 157 but the spec says

Multi-lingual content for labels, and hints is supported.

So basically, anything that might need this warning should be a label or a hint, correct? does tht question make sense?

It looks to me like media and string labels are the only kinds worth worrying about in translations, right? meaning that label:: media:: and hint:: are the three scenarios I need tests for? (testing the scenarios that languages are provided for one and not the other, with no default lang in settings)

@Ukang_a_Dickson just a quick bump in case you have thoughts on this, it was @LN 's idea to discuss this a bit more. Im going to start in on implementation but Ill make somethign thats pretty easy to change if we need to.

Updated text for warnings, I think these make more sense

                        "Missing translation for content on question! " + 
                        "language lacking translation: " + lang + 
                        "\n name: " + question_name +
                        "\n content missing translation: " + content_type
                    ) if lang != 'default' else (
                        "A `default_language` has not been set on this form.\n" +
                        "Set this in the settings tab and columns with no set " +
                        "language will default to the language specified there."

Thanks for pushing on with this, @KeynesYouDigIt.

There could possibly be quite a few of these warnings on a form definition so I think it's important to make sure that the warning message is compact. See also @Ukang_a_Dickson's code review note. I think it's that note which made you add the content type. I don't think that's necessary if the question name is clear. A more compact version of what you're proposing could be

Translation for language '{language}' missing for question '{question_name}'

This form is an example you may want to try with the change you are proposing. It's a case where several of the French translations are missing because they are on hold waiting for an explicit ask for them. I think it's not uncommon to only have a partial translation available and still need to try out the form. We want to make sure translation warnings don't drown everything else out.

I don't think default_language does what you think. It just determines which language is selected by the client at form launch if the user hasn't set a specific language. Any warning about default_language should occur exactly once.

Let's take a step back and review the original issue. That issue is about the choice of columns and settings, not about missing languages on individual questions. The ideal would be to identify all localizable columns in the form and all languages in the form and make sure that every localizable column exists in every language.

I believe the localizable column types are label, hint, media::image, media::video, media::audio but it would be good to double-check that in the code.

For example, if a form has columns label, hint, media::image, that's great, no problem. Similarly, if it has label::French (fr), hint::French (fr), media::image::French (fr), that's also great. pyxform takes care of making French (fr) the default language and everything works as expected. The problem is if a form has columns label::French (fr), hint::French (fr) and media::image. Now there are two languages in play: default and French (fr). However, French (fr) is missing the media::image column and the default language is missing the label and hint columns.

The challenge is to come up with a warning that would help a user. It might be something like "Translations are incomplete: languages French (fr) and default are missing columns. See https://xlsform.org/ for help."

1 Like

Wonderful answer thx. In between the wedding/COVID/general crazyness right now, im not sure when I will be able to jump on this, but I am hoping soon!