Skip to content

Handling missing choice labels #307

Description

@jnm

[edit] This is not a regression, but kpi inconsistently sends us both None and the empty string to represent a label that lacks a translation, e.g. either 'label': ['choose jif', None], or 'label': ['choose jif', ''], might be sent.

Question: should formpack treat these identically? It would then fall back to the choice name if the label is an empty string. That's what happens already if the label is None.

Abbreviated schema for context:

{
    'content': {
        'schema': '1',
            {
                'name': 'choosey_moms',
                'type': 'select_one',
                '$kuid': 'nBTaqfqN3',
                'label': ['choosey moms', 'las madres exigentes'],
                '$qpath': 'choosey_moms',
                '$xpath': 'choosey_moms',
                'required': False,
                'select_from_list_name': 'vl8ap24',
            },
        ],
        'choices': [
            {
                'name': 'choose_jif',
                '$kuid': 'T06KYSoia',
                'label': ['choose jif', None],
                'list_name': 'vl8ap24',
            },
            {
                'name': 'choose_gif',
                '$kuid': '91CVcUFYb',
                'label': ['choose GIF', 'elige GIF'],
                'list_name': 'vl8ap24',
            },
        ],
        'translated': ['label'],
        'translations': ['English (en)', 'Español (es)'],
    },
}

Internal discussion: https://chat.kobotoolbox.org/#narrow/stream/4-Kobo-Dev/topic/formpack.20and.20missing.20labels/near/173165

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions