Skip to content

Support customization of text in connection forms from connectors or other packages #58

@altvod

Description

@altvod

Instead of creating Translatable instances with a fixed i18n domain from within the form, we need to implement some kind of factory that would be accessible via SR and would create translatables with a custom domain given a translation key.
Let's call it TextProvider. It would look something like this:

from dl_i18n.localizer_base import Translatable

class TextProvider:
    def get_translatable(self, text_key: str, default_i18n_domain: str) -> Translatable:
        ...

This TextProvider instance can be supplied to form factory instances so that they can implement a method like this:

SomeFormFactory:
    text_provider: TextProvider
    default_i18n_domain: str

    def get_translatable(self, text_key: str) -> Translatable:
        return self.text_provider.get_translatable(text_key, default_i18n_domain=self.default_i18n_domain)

Packages provide custom texts in their own i18n domains, and a list of these custom domains should be provided via settings to the TextProvider instance.

Internal issue: BI-4909

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