Content-types control panel: zope.schema._bootstrapinterfaces.ConstraintNotSatisfied: ('en-us', 'language')

I am getting this error for some DX content types when clicking on the "fields" tab of a content type within the control panel. In this particular case the site language is NL, allowed languages are NL + EN.

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 162, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 359, in publish_module
  Module ZPublisher.WSGIPublisher, line 254, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 63, in call_object
  Module plone.z3cform.layout, line 63, in __call__
  Module plone.z3cform.layout, line 47, in update
  Module plone.z3cform.fieldsets.extensible, line 65, in update
  Module plone.z3cform.patch, line 30, in GroupForm_update
  Module z3c.form.group, line 141, in update
  Module z3c.form.group, line 52, in update
  Module z3c.form.group, line 48, in updateWidgets
  Module z3c.form.field, line 277, in update
  Module z3c.form.browser.select, line 51, in update
  Module z3c.form.browser.widget, line 171, in update
  Module z3c.form.widget, line 234, in update
  Module Products.CMFPlone.patches.z3c_form, line 47, in _wrapped
  Module z3c.form.widget, line 115, in update
  Module zope.schema._bootstrapfields, line 113, in __get__
  Module zope.schema._bootstrapfields, line 292, in validate
  Module zope.schema._field, line 483, in _validate
zope.schema._bootstrapinterfaces.ConstraintNotSatisfied: ('en-us', 'language')

Not sure where this en-us would come from

(Pdb++) pp self.__dict__
{'_Element__tagged_values': None,
 '__doc__': 'label_language',
 '__name__': 'language',
 '_init_field': False,
 '_resolve_vocabulary': <function Choice.bind.<locals>.<lambda> at 0x7fe1f3708310>,
 'context': <TypeSchemaContext at /Plone2/dexterity-types/SubsiteFolder>,
 'default': None,
 'defaultFactory': <function default_language at 0x7fe1fcfa54c0>,
 'description': '',
 'interface': <SchemaClass plone.app.dexterity.behaviors.metadata.ICategorization>,
 'missing_value': '',
 'order': 1020,
 'readonly': False,
 'required': False,
 'title': 'label_language',
 'vocabulary': <zope.schema.vocabulary.SimpleVocabulary object at 0x7fe1f3b998e0>,
 'vocabularyName': 'plone.app.vocabularies.SupportedContentLanguages'}
(Pdb++) pp value
'en-us'

This boils down to

[27] > /home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/plone.app.dexterity-2.6.5-py3.8.egg/plone/app/dexterity/behaviors/metadata.py(49)default_language()
-> language = context.Language()
(Pdb++) pp context
<TypeSchemaContext at /Plone2/dexterity-types/SubsiteFolder>
(Pdb++) pp context.Language
<bound method DefaultDublinCoreImpl.Language of <PloneSite at /Plone2>>
(Pdb++) pp context.Language()
'en-us'

Actually the site language of the portal object is used which points itself to en-us although the en-us was actually never used or specified somewhere.

[28] > /home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/Products.CMFPlone-5.2.2-py3.8.egg/Products/CMFPlone/DublinCore.py(263)Language()
-> return self.language
(Pdb++) pp self
<PloneSite at /Plone2>
(Pdb++) pp self.language
'en-us'

So the final solution here is to set portal.language = "nl" somewhere as part of our migration process.

I feel this might be related to https://github.com/plone/Products.CMFPlone/issues/2168

Plone Foundation Code of Conduct