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."