Skip to content

Add a fallback mechanism #20

@umazalakain

Description

@umazalakain

Right now LocalizedValue falls back to the primary language if no translation for the current language is present. I think it's interesting if the user could specify a fallback chain. This could be in a per-missing-language fashion:

LOCALIZED_FIELDS_FALLBACKS = {
    'en': ['es', 'eu'],
    'es': ['eu', 'en'],
    'eu': ['es', 'en'],
}

For backwards compatibility, LOCALIZED_FIELDS_FALLBACKS.get(lang, [PRIMARY_LANGUAGE]).

Alternatively, the setting could be a function that is given the missing language and field info.

This could be a global setting or a field parameter.

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